1

I want a radio button to be automatically selected every time it is open in the screen. so that the user will no longer click it. what attribute will i use?

<input type="radio" name="sex" value="male">Choose<br>
Jonas
  • 121,568
  • 97
  • 310
  • 388
user3630809
  • 33
  • 1
  • 6

4 Answers4

0

Add checked

<input type="radio" name="sex" value="male" checked>Choose<br>

To hide the radio button use below css:

input[type="radio"]:checked{
    visibility:hidden;
}
Godinall
  • 2,280
  • 1
  • 13
  • 18
0

checked attribute used to set your radio button or checked box to pre-selected state while page is loaded.

<input type="radio" name="sex" value="male" checked>Choose</br>
kamesh
  • 2,374
  • 3
  • 25
  • 33
0
<input type="radio" name="sex" value="male" checked='checked'>Choose<br>
Ramki
  • 519
  • 2
  • 9
0
<input type="radio" name="sex" value="male" checked>Male</br>
<input type="radio" name="sex" value="female">Female</br>

Click Here for the working example on jsFiddle.

Hope this helps

AbdulRahman Ansari
  • 3,007
  • 1
  • 21
  • 29