How to return radio checked object with jQuery ?

Posted by Kim on Stack Overflow See other posts from Stack Overflow or by Kim
Published on 2010-05-17T11:55:28Z Indexed on 2010/05/17 12:00 UTC
Read the original article Hit count: 296

HTML

<input type="radio" name="rdName" id="uniqueID1" value="1" checked="checked">
<input type="radio" name="rdName" id="uniqueID2" value="2">
<input type="radio" name="rdName" id="uniqueID3" value="3">

jQuery #1

$('input:radio[name=rdName]:checked').val();

jQuery #2

$('input[name=rdName]:checked');

jQuery #1 gets the value of checked radio, but I need to get the whole object to get the ID. jQuery #2 get this (from Chrome Dev console). Object "0" is the actual object I need, but I am unable to just that.

0: HTMLInputElement
constructor: function Object()
context: HTMLDocument
length: 1
prevObject: Object
selector: input[name=rdName]:checked
__proto__: Object

Any ideas how to isolate the needed object ?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery