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

enter image description here

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

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -