ad

Wednesday, October 1, 2025

html radio buttons example


HTML Radio Buttons Example


https://webdesigningtheory.blogspot.com

<input type = "radio">

A radio button is the allowing a single value to be selected out of multiple choices.  we can say that used to restrict user to choose only one option out of many.

Program 

<!DOCTYPE html>

<html>

<body>

 <h2>Radio Buttons</h2>

 <p>The <strong>input type="radio"</strong> defines  radio button:</p>

<form action="/action">

<input type="radio" name="grade" value="First" checked> First<br>

<input type="radio" name="grade" value="Second"> Second<br> 

<input type="radio" name="grade" value="Third"> Third<br>

<input type="radio" name="grade" value="Fail"> Fail<br><br>

<input type="submit">

</form>
</body>
</html>


Explain Program

Step 1 ]

<!Doctype html>

  • <!doctype html>  always be the first line of any HTML document.

Step 2 ]

   <html> and </html>

   html  is the root element.

Step 3 ]

<body> and </body>

body  is  main content area.

All visible content inside to  the <body> tag

Step 4]

<p>The <strong>input type="radio"</strong> defines  radio button:</p>
              text input type="radio"  , bold  use <strong>

Step 5]


<form action="/action">

    browser  send the form data 

Step 6]


<input type="radio" name="grade" value="First" checked> First<br>

<input type="radio" name="grade" value="Second"> Second<br> 

<input type="radio" name="grade" value="Third"> Third<br>

<input type="radio" name="grade" value="Fail"> Fail<br><br>
 
1]  radio button :-  labeled  :- first, Second, Third ,Fail 
2]  name  :-   grade :-  radio button have same name
3]  value :-   value sent to server when form is submitted.        
4]  <br>  :-  line break 

Step 7]

<input type="submit">

adds submit button to form 

HTML Radio Buttons Example

Output 



Related Post :-

How to Create Ordered Lists in HTML for Free (With Examples)

html checkbox input: syntax, examples


No comments:

Post a Comment