Radio button
Radio button
I am having a issue with my radio buttons.
I am working with a auto-complete form and everything looks fine besides the buttons. When I start typing the persons name the list of options pop up from my database. Then I select the name from the list and the form populates. I cant seem to get the buttons to check. The database is using 1 for male and 2 for female,
If I use this code to test, the button checks correctly based on the number used.
- $("#2").prop("checked", true); //working
This one checks radio 2. Female.
This does not work.
- $("#" + ['5']).prop("checked", true);
['5'] is the database value that holds the number 1 or 2. I am calling it correctly because the rest of the feilds are using the same code and pull the data correctly.
I did one more test and made a text field and used this code.
- $("#5").val(ui.item['5']);
It pulls my 1 or 2 correctly. What is wrong with this $("#" + ['5']).prop("checked", true); ???
This is my button fields.
- M » <input type = radio id="1" name = 'frm_gender' value = 1 onClick = 'this.form.frm_gender_val.value=this.value;' <?php echo $checks[1];?> <?php print $dis;?> />
- F » <input type = radio id="2" name = 'frm_gender' value = 2 onClick = 'this.form.frm_gender_val.value=this.value;' <?php echo $checks[2];?> <?php print $dis;?>/>
The buttons work fine but I just need the auto-complete to click them to.
Thank You...