HTML5 in older browsers?

I am working on a page and I would like to use HTML 5 setCustomValidity . It’s easy enough to check if the browser supports:

 var inpt = document.getElementsByTagName("input")[0]; // etc. if(typeof(inpt.setCustomValidity) != 'function') // workaround here 

But I'm not sure if there is a reasonable way to handle this. Of course, I can write the setCustomValidity function in this case, but it will not have context (right?) To deal with the event. If maybe I have functions, call it by their proper names?

If there is a library that handles this (Modernizr, etc.), that would be great. If there is a good workaround, I would be happy to use this.

I have some ugly hacks, but I would prefer to do it my own way, if possible, whatever that is.

+4
source share
2 answers

This may be what you are looking for if you don't mind using jQuery: http://afarkas.github.com/webshim/demos/index.html

Rollback for form validation in browsers that do not support them: http://afarkas.github.com/webshim/demos/demos/webforms.html

+3
source

I heard a lot about Modernizr and based on the attention I received, I would definitely say that we will try.

+1
source

All Articles