Is there a way to determine the default value that should be selected in the form of HTML radio buttons?

<body> <form> <input type="radio" name="amount" value="10"/> $10&#8194 <input type="radio" name="amount" value="25"/> $25&#8194 <input type="radio" name="amount" value="50"/> $50&#8194 <input type="radio" name="amount" value="100"/> $100&#8194 <input type="radio" name="amount" value="250"/> $250&#8194 <input type="radio" name="amount" value="other"/> Other </form> </body> 

To set the default $ 50 parameter, which HTML code will I use?

Link to bin code demo

+4
source share
3 answers

Just set it as a checked box:

 <body> <form> <input type="radio" name="amount" value="10"/> $10&#8194 <input type="radio" name="amount" value="25"/> $25&#8194 <input type="radio" name="amount" value="50" checked="checked" /> $50&#8194 <input type="radio" name="amount" value="100"/> $100&#8194 <input type="radio" name="amount" value="250"/> $250&#8194 <input type="radio" name="amount" value="other"/> Other </form> </body> 
+11
source

Just add

checked = "checked"

in the ad buttons. Which u wants to be installed by default.

+5
source
 <input type="radio" name="amount" value="50" checked="checked"/> 
+3
source

Source: https://habr.com/ru/post/1392413/


All Articles