How do I get the name or id of the element to jquery
+1
A:
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.
Felix Kling
2010-02-11 22:23:12
Ok. I did. I wanted to get the name of the html element
TeknoSeyfo
2010-02-11 22:24:39
Don't forget quotes around "#the-ID".
Wayne Koorts
2010-02-11 22:24:54
+2
A:
If you want to get the name/id from a selection
$().attr('name')
$().attr('id')
or for selecting element(s)
$('*[name="somename"]')
$('#someid')
Simon
2010-02-11 22:23:14