javascript - Can input value artribute be defined as empty? -
i have following code:
<input type = "text" value="" class="myclass"/> can value declared empty?
in chrome debugger, appears following, doesn't correct
however onkeypress event never fired. i'm guessing it's because "value" attribute looks bit weird , causing break, dont know sure. works in firefox.
yes, can.
var myinput = document.getelementbyid('ourinput'); if(myinput.value.length == 0) myinput.value = "empty"; note: myinput.value =="" too.

Comments
Post a Comment