Why does the command
alert($(this).attr("开发者_C百科id"));
return "undefined"? I'm using it in ASP NET and Internet Explorer 8.
http://api.jquery.com/attr/
If we try to get the value of an attribute that has not been set, the .attr() method returns undefined.
Maybe some informations are missing? ^^
Either this
does not have an ID, or it's not the element you think it is.
I think 'this' is referring to the alert box which I am guessing does not have an attribute called id.
精彩评论