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

apache - setting document root in antoher partition on ubuntu -

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

Process 'command 'F:\android-sdk\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 1 -