0

i have a group ooa radion buttons defined as so

<input type="radio" name="required[status]" id="status" value="1">Yes </label>
<input type="radio" name="required[status]" id="status_1" value="0"> No </label>
<input type="radio" name="required[status]" id="status_2" value="2">Maybe </label>

this is stores the value 0,1,2 in a field status in the db

later, i get the value from db as 1, how do i use jquery to check the appropriate radio button?

1
  • What have you already tried? Where do you get stuck? Show some effort Sep 21, 2014 at 22:24

1 Answer 1

1

if you are trying to check the radio button element by its value you can you the jquery attribute selector.

click me

you can get the element by its value like this:

$('[value=VALUE_FROM_DB]').prop("checked", true);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.