Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

input type = checkbox problem

Tags:

html

Why is this line not working?

<input type="checkbox" checked="no"/>
                    <input type="checkbox" checked="false"/>

Even though i have specified no and false in checkbox value both are checked by default.

Thanks in advance :)

like image 684
TCM Avatar asked Dec 30 '25 09:12

TCM


2 Answers

changing it to this will make the first unchecked, and the second checked :

 <input type="checkbox" />
 <input type="checkbox" checked />

To make the checkbox unchecked you need to remove the word "checked".

like image 187
NimChimpsky Avatar answered Jan 01 '26 23:01

NimChimpsky


Try this -

<input type="checkbox" checked/>

The attribute "Checked" will keep your checkbox checked by default. If you do not have this attribute mentioned, then the checkbox will be unchecked by default.

like image 28
Sachin Shanbhag Avatar answered Jan 01 '26 23:01

Sachin Shanbhag