better input validation
add content type header
tidy comments, use consistent array style
oninput is the correct event. onchange for compat.