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.
source share