I'm attempting to call the msgs.loginUsername property, by dynamically grabbing "loginUsername" from the html with jQuery. However, I can't figure out how to structure the syntax to get it to work.
the object:
msgs = {
loginUsername : "Username is required.",
loginPassword : "Password is required."
};
the call:
function validateElements(_class) {
var errors = 0;
jQuery(_class).each(function() {
if (!validate.required(this)) {
var name = jQuery(this).attr('name'); //TROUBLE
alert(msgs.name); //TROUBLE
errors += 1;
}
});
return errors > 0 ? false : true;
}