javascript - Dropdown options can't access with jquery selector? -
i have drop down in webpage.it's aspx page.but try access drop down javascript.here code. code working.
var = document.getelementbyid('mydropdown'); alert(a.options.length);
this code not working
var = $('#mydropdown'); alert(a.options.length);
i getting following error.
typeerror: cannot read property 'length' of undefined
any 1 have idea.
$('#mydropdown') jquery object , treating dom object. try changing
var = $('#mydropdown');
to
var = $('#mydropdown')[0];
Comments
Post a Comment