Remember to be careful how you mix the various quotes ' and ". The
following should work.

$('#Demo[value="hello there"]').attr('checked', true);

Karl Rudd

On Tue, May 20, 2008 at 11:33 AM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
> I may have spoken a little too soon.  Karl, that was a great solution,
> but what if the part of the value clause has a space in it?  This
> isn't working for me ...
>
> $('#Demo[value=hello there]').attr('checked', true);
>
> nor is this ...
>
> $('#Demo[value="hello there"]').attr('checked', true);
>
> Any suggestions are greatly appreciated, - Dave
>
>
> On May 19, 7:56 pm, "Karl Rudd" <[EMAIL PROTECTED]> wrote:
>> Assuming the following:
>>
>>   <input type="radio" name="someName" id="Demo" value="hello">
>>
>> The following will "check" the radio button:
>>
>>   $('#Demo').attr('checked', true);
>>
>> If you _really_ need to ONLY check the radio button if it's got an
>> id="Demo" AND value="hello":
>>
>>   $('#Demo[value=hello]')
>>
>> Karl Rudd
>>
>> On Tue, May 20, 2008 at 8:47 AM, [EMAIL PROTECTED]
>>
>>
>>
>> <[EMAIL PROTECTED]> wrote:
>>
>> > Hi,
>>
>> > When my page loads, I'd like to check a radio button whose ids are
>> > "Demo" and whose value is "hello".  How do I do this with JQuery?
>>
>> > Thanks, - Dave- Hide quoted text -
>>
>> - Show quoted text -
>

Reply via email to