开发者_开发技巧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.
精彩评论