In a web application or in a form page set reset radio button and set reset checkbox using jQuery. The jQuery reset this using prop() method, you can use in your web browser.
Create a reset button and give button id name and connect the jQuery JS file for working with jQuery in your page. After select one option or multiple checkbox, you can reset the button or checkbox and select it again.
You can use the source code in your web application, which I give your in the below of text. Follow the example and try this code:
Example and Source code:
<html> <head> <title>Reset Radio/Checkbox Button using jQuery</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> </head> <body> <!-- Form Start: --> <form> <label>Select Gender</label> <input type="radio" name="gender" value="m">Male</input> <input type="radio" name="gender" value="f">Female</input> <input type="radio" name="gender" value="o">Other</input><br/> <label>Select Nationality</label> Indian<input type="checkbox" name="nationality" value="I"> Pakistan<input type="checkbox" name="nationality" value="P"> Chinese<input type="checkbox" name="nationality" value="C"> <input type="submit" name="submit" value="Submit" /> <input type="button" name="reset_radio" id="reset_radio" value="Reset" /> <input type="button" name="reset_nationality" id="reset_nationality" value="Reset Nationality" /> </form> <!-- // Form End: --> <!-- Script: --> <script type="text/javascript" language="javascript" > $(document).ready(function(){ $("#reset_radio").on('click',function(){ $('input[name="gender"').prop('checked',false); }); $("#reset_nationality").on('click',function(){ $('input[name="nationality"').prop('checked',false); }); }); </script> </body> </html>
Click here: to view jQuery mouse event and example step by step
Thanks for visiting our blog. Follow our blog site because we have more jQuery Tutorial and we have more tutorial related different type of programming language. You will be happy to know that the DataInFlow is a platform, where you can get the text tutorial and video tutorial of a different kind of programming language like PHP, HTML, Javascript, Jquery, CSS3 and get some more programming tutorial.
You much like DataInFlow.com because it provides you to ask any kind of programming questions and get answer in quick time. Also you can answer any others question if you know. If you have any programming question, so Click for ASK Here.