views:

151

answers:

2

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?

+3  A: 

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']").

Mark Hurd
+3  A: 

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');
lpfavreau