Input in HTML5, checkbox gets unchecked -


i have following html5 code

<!doctype html> <html> <head>     <title>learning input</title> </head>   <body>     <input type=text value="enter name" maxlength="10"> <br>     <input type=checkbox checked> </body> </html> 

which working fine, way. checkbox expected checked. however, after adding 1 line of code introduce password field, following code makes checkbox unchecked, tough have marked "checked". not make sense! breaking html5 rule?

the code after adding password field:

<!doctype html> <html> <head>     <title>learning input</title> </head>   <body>     <input type=text value="enter name" maxlength="10"> <br>     <input type=password> <br>     <input type=checkbox checked> </body> </html> 

help appreciated. in advance! :)

your code correct ..working on chrome, firefox mozilla , ie

    <!doctype html> <html> <head>     <title>learning input</title> </head>   <body> <form>     <input type=text value="enter name" maxlength="10"> <br>     <input type=password> <br>     <input type=checkbox checked> </form> </body> </html> 

Comments