开发者

Why does the command, alert($(this).attr("id")); return "undefined"?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜