Jquery - Object.id Is Undefined When It Shouldn't Be
I'm working with JQuery and i'm running into this strange (or perhaps stupid) error. In my HTML I have:
Solution 1:
o is a reference to a jQuery object, NOT a DOM element reference. Inside your validateRepeatPassword function do:
alert( $(o).attr('id') );
If you want to access the direct DOM element's property from the jQuery object,
alert( o[0].id )
alert( o.get(0).id );
Solution 2:
Inside your function o
is a jQuery object, you should grab the id with the attr function of of o
.
alert(o.attr('id'));
But if you want to work directly with the DOM element on your validateRepeatPassword
function, you can pass a reference to the element:
validateRepeatPassword($('#id_repeatPassword').get(0));
Post a Comment for "Jquery - Object.id Is Undefined When It Shouldn't Be"