开发者

How do I get the name or id of the element ?? Jquery

开发者_开发技巧How do I get the name or id of the element to jquery


If you want to get the name/id from a selection

$().attr('name') 

$().attr('id')

or for selecting element(s)

$('*[name="somename"]')

$('#someid')


Do you want to know the ID so can use it in the selector like $('#the-ID')? Either set it yourself if you can or look it up in the HTML source code.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜