I have input tags with a user defined attribute as:-
<input name="grp1" type="radio" myUDF="value1" />
<input name="grp1" type="radio" myUDF="value1" />
How can i extract the value of myUDF?
The scenario is :-
$("input[name=grp1]").click(function(){
this.attr("myUDF"); // This throws the exception Object doesnt support this prop or mehod
});
'this' is the dom object - not a jquery object therefore it does not have the attr function.
You need to create a jq object with this eg
$(this).attr("myUDF");
you can get attribute value like that:
$("input[name=grp1]").click(function() {
alert($(this).attr("myUDF"));
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.