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.