I'm doing a workaround to a complex problem and it requires me to do it the way I am doing it.
I'm testing for the presence of a certain class - intra-field-label
. The elements will have multiple classes. How can I do this?
...
arn: {
required: function(element) {
return //element #arn has no class 'intra-field-label' means TRUE
}
},
ann: {
required: function(element) {
return //element #ann has no class 'intra-field-label' means TRUE
}
},
...
The fields both have the name and id "arn" and "ann", respectively.
Update:
I found that the text input has a class called "intra-field-label" when there is the label present (indicating that the user has not input anything). Perhaps I can test for the pres开发者_StackOverflowence? I don't believe .val() will work here.
You need to change them to return ($("#arn").val() != "Enter the Retailer Name");
and return ($("#ann").val() != "Enter Your Name");
for it to treat them like proper conditionals.
If you just want to test whether the element has the intra-field-label
class or not:
return $(element).hasClass('intra-field-label');
精彩评论