 <p>If you want to get the name/id from a selection</p> <pre><code>$().attr('name') $().attr('id') </code></pre> <p>or for selecting element(s)</p> <pre><code>$('*[name="somename"]') $('#someid') </code></pre>