Reputation: 34689
Here is my view source:
<input id="ctl00_cp_ctrlNew_lendeeMe" type="radio" name="ctl00$cp$ctrlNew$whoBorrowed" value="lendeeMe" />
And I am trying to use this selector to check one of them, but it is not working:
$("input[@id$='lendeeMe']").attr('checked','checked');
but if I do this, it works fine:
$("#ctl00_cp_ctrlNew_lendeeMe").attr('checked','checked');
That is due tot he crazy way asp.net makes controls, so I figured using the previous selector would be easier. What am I doing wrong?
Upvotes: 0
Views: 288
Reputation: 330
$("input[id$='lendeeMe']").attr('checked','checked');
because "@" fell into disuse in jquery
Upvotes: 3
Reputation: 13211
What version of jQuery are you using?
Because as said here:
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 maybe you want to simply try:
$("input[id$='lendeeMe']").attr('checked','checked');
Upvotes: 3
Reputation: 13076
The [@attr]
style selectors were removed in jQuery 1.3. (Deprecated in 1.2). Try removing the @ sign.
Or, base it off another attribute, like $("input[value='lendeeMe']")
.
Upvotes: 3