Originally Posted by AndrewGSW
: I might also prefer:
elm[ (elm.value) ? "value" : "innerHTML" ] = output;
were showing off js here, not html. the function is fine. i wanted to remind folks of html options as a side-effect.
if you simply check for .value, you can erroneously hit on <li> and possibly others.
also, that misses empty inputs.
anything a user can edit with the keyboard should have a select method attached, custom controls included.
BROWSER STATS [% share]
(2013/10/31) IE7:0.5, IE8:8.6, IE9:5.3, IE10:12.3, FF:17.7, CH:41.8, SF:8.1, MOBILE:20.4