How to select a radio button dynamically in a radio group using a value ?
Using j-query. So that on page load the value will be selected.
Asked
Active
Viewed 102 times
-1
-
3Hi! first you need to read [this](https://stackoverflow.com/help/asking) and understand how to ask proper questions. This site is not a forum here we help other programmers to solve or trouble shoot problems with their written code. What you're asking is for a code which is ready to be copy pasted which won't happens here. Try first show what you tried and ask for help on that code. Asking questions like this will earn you down votes and too many will get you restricted from using lot of functions in the site. – S4NDM4N Aug 23 '17 at 06:13
-
Possible duplicate of [How can I know which radio button is selected via jQuery?](https://stackoverflow.com/questions/596351/how-can-i-know-which-radio-button-is-selected-via-jquery) – RealCheeseLord Aug 23 '17 at 06:26
-
1Possible duplicate of [Set selected radio from radio group with a value](https://stackoverflow.com/questions/4618733/set-selected-radio-from-radio-group-with-a-value) – Ignatius Aug 23 '17 at 06:40
1 Answers
1
You can also use the .prop method with a boolean value. Try using this piece of JQuery code in your application.
$("input[name=mygroup][value=" + value + "]").prop('checked', true);

Karthik
- 39
- 7
-
It's advised not answer these questions let the OP try and post his/her code. If you use this site understand one thing this place is not a code writing service in future avoid answering these types of questions. – S4NDM4N Aug 23 '17 at 06:21