View Single Post
Old 12-07-2012, 09:29 PM   PM User | #6
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,468
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
Quote:
Originally Posted by AndrewGSW View Post
Added: I might also prefer:

Code:
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.
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%

Last edited by rnd me; 12-07-2012 at 09:32 PM..
rnd me is offline   Reply With Quote