Side navigation
#7191 closed bug (invalid)
Opened October 14, 2010 08:37PM UTC
Closed October 14, 2010 09:24PM UTC
Last modified October 14, 2010 09:32PM UTC
Get just the first radio group value
| Reported by: | webskate | Owned by: | |
|---|---|---|---|
| Priority: | undecided | Milestone: | 1.4.3 |
| Component: | unfiled | Version: | 1.4.2 |
| Keywords: | Cc: | ||
| Blocked by: | Blocking: |
Description
when i try to get the value of two radio checked from two radio group diferents I always get the value of the first radio checked, I've tried with jqyery 1.4.2 and 1.3.2 and got this error but with jquery 1.1.2 works fine.
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script language="JavaScript" type="text/JavaScript" >
function pegarValores(){
alert($('input[@name=teste_radio]:checked').val());
alert($('input[@name=teste_radio_2]:checked').val());
}
</script>
</head>
<body>
<form id="testeForm" name="testeForm">
abc <input type="radio" name="teste_radio" value="1"/>
def <input type="radio" name="teste_radio" value="2"/>
ghi <input type="radio" name="teste_radio" value="3"/><br/>
jkl <input type="radio" name="teste_radio_2" value="4"/>
mno <input type="radio" name="teste_radio_2" value="5"/>
pqr <input type="radio" name="teste_radio_2" value="6"/>
<input type="button" onclick="pegarValores()" value="pegar valores"/>
</form>
</body>
</html>
Attachments (0)
Change History (2)
Changed October 14, 2010 09:24PM UTC by comment:1
| resolution: | → invalid |
|---|---|
| status: | new → closed |
Changed October 14, 2010 09:32PM UTC by comment:2
From http://api.jquery.com/category/selectors/attribute-selectors/
Note: In jQuery 1.3 [@attr] style selectors were removed (they were previously deprecated in jQuery 1.2). Simply remove the “@” symbol from your selectors in order to make them work again.
So using [@attr] is a no go since jQuery 1.2. By simply removing the @ from your selectors everything works fine for me
Thanks for the report, but this is not a bug. jQuery has not supported XPath selectors for a very long time. Please read the changelogs and documentation. In the future, please use the jQuery Forum for support requests.