Friday, 27 September 2013

Can't find how to define if id exist in $(this)

Can't find how to define if id exist in $(this)

In many fieldset, with a next button i try to find if there is "#required"
id input, and then, if it's empty, return false (stay in this fieldset)
else go on actions ...
if ($(this).attr('required').length == 0) {
alert ('oui');
if (!$(this).attr('required'))
return false;
}
else
alert ('non');
But $(this).attr('required').length is undefined because no id found.
need help, thanks for all.

No comments:

Post a Comment