Topic: get the selected value from multiple radio buttons
bcatalin free asked 4 years ago
On this snippet https://mdbootstrap.com/snippets/jquery/bcatalin/857933 How can I get the text "Option x" depending on which radio button was clicked ?
Assign the "value" attribute in the "input" tag:
<input type="radio" class="form-check-input" id="materialGroupExample1" name="groupOfMaterialRadios" value="1">
Assign it to every radio input element
Yes. see updated snippet. It shows and empty string value.
I've tried also console.log($("input[name='groupOfMaterialRadios']:checked").val()) but just return "on" string
Do you have any ideas ?
did you try to use this jQuery
.text() method ?
labelText = $("#myLabel").text()) try to add this to your code
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
- User: Free
- Premium support: No
- Technology: MDB jQuery
- MDB Version: 4.8.4
- Device: PC
- Browser: chrome
- OS: Windows
- Provided sample code: No
- Provided link: Yes