How to make Radio Button Checked By Default?




This small article will explain you,about, Assign an initial value to radio button as checked.

code:
<input type="radio" name="r1"  value=""  /> male
<input type="radio" name="r1"  value=""  /> female

now with using above code two radio buttons get created.
(By default no one is selected)

Now, we are going to code for By default set as checked.

See Code:

<input type="radio" name="r1"  value="" checked /> male
<input type="radio" name="r1"  value=""  /> female


Now result of this code is: By default "male" radio button is checked.

Thats All.

No comments:

Post a Comment

We are here to listen you, Comment your valueable opinion...!!!