Reputation: 196489
i have the following code in an asp.net-mvc view:
<input checked="checked" id="outputFilter" name="outputFilter" value="Detail" type="radio"> Detail Info
<input id="outputFilter" name="outputFilter" value="Summary" type="radio"> Summary Info
<input checked="checked" id="outputSorting" name="outputSorting" value="Milestone" type="radio"> Milestone
<input id="outputSorting" name="outputSorting" value="AppRank" type="radio">App --> Rank
and i have this javascript code:
var sortValue = $("input[@name='outputSorting']:checked").val();
var dataValue = $("input[@name='outputFilter']:checked").val();
the issue is that i get the value "Detail" for BOTH sortValue and dataValue
can anyone see anything wrong with this code that would lead this to be the case??
Upvotes: 2
Views: 177
Reputation: 141879
Remove the @
sign. That has been deprecated long ago for attributes.
var sortValue = $("input[name='outputSorting']:checked").val();
var dataValue = $("input[name='outputFilter']:checked").val();
Also, close your input tags to make the HTML valid.
<input ... value="Detail" type="radio" /> Detail Info
<input id="outputFilter" ... type="radio" /> Summary Info
...
Upvotes: 4