Can I add HTML5 elements to existing HTML documents? -



Can I add HTML5 elements to existing HTML documents? -

so have existing html page has field lastly 4 digits of credit card:

<input value="" name="last4ofcc" maxlength="4" id="last4ofcc1">

works great, feature request came in create numeric field , not allow non-numeric characters.

at first thought of plugging in javascript, thought, why not utilize html5 element. changed following:

<input type="number" value="" name="last4ofcc" max="4" id="last4ofcc1">

but not still allow non-numeric characters, max attribute doesn't work either! i'm testing on firefox 8, not sure problem is.

does know i've done wrong here?

you need include proper doctype @ top of page in add-on changing input types.

<!doctype html>

however, it's not going think it's going to. setting input type="number" pretty much spinners on side , tell form should be. if want ensure digits entered, need regex, /^\d+$/ on keyup.

more info on html5

html html5

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -