Link to home
Create AccountLog in
Avatar of hidrau
hidrauFlag for Brazil

asked on

How can I check an option of my radiogroup?

Hello

I'd like to have a function where I could pass the name of radio and value so that the function could check the option

Here we have some code

 <input name="f_tab_4_tipo_frete" type="radio" id="f_tab_4_tipo_frete_0" value="1"/>Emitente
 <input name="f_tab_4_tipo_frete" type="radio" id="f_tab_4_tipo_frete_1" value="2"/>Destinatário

Open in new window



Thanks
Avatar of Big Monty
Big Monty
Flag of United States of America image

try something like this:

function checkRadio( radioName, radioValue ) {
         $('input:radio[name=' + radioName + ]').filter('[value=' + radioValue + ']'.attr('checked', true);
}

taken from http://stackoverflow.com/questions/871063/how-to-set-radio-option-checked-onload-with-jquery
ASKER CERTIFIED SOLUTION
Avatar of HainKurt
HainKurt
Flag of Canada image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of hidrau

ASKER

thanks,

very easy and fast