-
-
Save eksana/91b3fa35baceeb256b9362370a5c0fd1 to your computer and use it in GitHub Desktop.
радиокнопки в группе
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HTML Radio Button Tag | |
Code to create radio button in html? | |
How to create pre selected radio button (checked)? | |
How to disable (non selectable) radio button? | |
Explanation | |
Radio Button | |
Example : | |
<form name=myform> | |
<input type="radio" name=myradio value="1">one | |
<input type="radio" name=myradio value="2">two | |
<input type="radio" name=myradio value="3">three | |
</form> | |
Result : | |
one two three | |
Definition: | |
Here we define the radio button using "input" tag. We give a attribute called "TYPE=RADIO" in the tag which defines the type as a radio button. The attribute name should be defined and be same. The value in this case will be used only during form processing. | |
Note: All the input of this type should have the same name. This name is what groups them. If you have different names for each radio button then they will behave individually. | |
Example : | |
<form name=myform> | |
<input type="radio" name=myradio1 value="1">one | |
<input type="radio" name=myradio2 value="2">two | |
<input type="radio" name=myradio3 value="3">three | |
</form> | |
Result : | |
one two three | |
Pre selected RadioButton | |
If we want the radiobutton to be shown selected even before the user tries to select one, we have to use the entry "checked". | |
Example : | |
<form name=myform> | |
<input type="radio" name=myradio value="1" >one | |
<input type="radio" name=myradio value="2" checked>two | |
<input type="radio" name=myradio value="3" >three | |
</form> | |
Result : | |
one two three | |
Non Editable / Un selectable radio | |
We can make a radio button unselectable (disable) using the entry "disabled" | |
Example : | |
<form name=myform> | |
<input type="radio" name=myradio value="1" disabled>one | |
<input type="radio" name=myradio value="2" checked disabled>two | |
<input type="radio" name=myradio value="3" disabled>three | |
</form> | |
Result : | |
one two three | |
https://www.hscripts.com/tutorials/html/form-radiobutton.php |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://www.hscripts.com/tutorials/html/form-radiobutton.php