mardi 8 août 2017

HTML checkbox won't display correctly with javascript

Shouldn't this javascript just display an unchecked checkbox followed by the text "MyCheckBox"? Instead, it's just displaying "checked."

<html>
<head>
<script>
    var data = false;
    document.write('<input type="checkbox" ' + data ? "checked" : "" + '>MyCheckBox');
</script>
</head>
<body>


</body>
</html>




Aucun commentaire:

Enregistrer un commentaire