goodk
asked on
How to check for Pattern if you have an event such as on
<input type="text" name="country_code" pattern="[A-Za-z]{3}" title="Three letter country code">
onmouseleave=showHint(this .value)
It appears that the event gets fired first before the pattern is tested. It does check the pattern on form submit. I however want it to test the pattern before firing the event on onmouseleeave, showHint.
How do we check for pattern before firing an event function?
onmouseleave=showHint(this
It appears that the event gets fired first before the pattern is tested. It does check the pattern on form submit. I however want it to test the pattern before firing the event on onmouseleeave, showHint.
How do we check for pattern before firing an event function?
ASKER
Oh, I know about jQuery or using javascript in a function.
I was wondering if the pattern could be checked before calling the function?
There is something missing in my understand of the html5 Pattern
I was wondering if the pattern could be checked before calling the function?
There is something missing in my understand of the html5 Pattern
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
so why cant i just do the regular expression in javascript.?
You always have the option of using regular expression in JavaScript. The point of using pattern is to avoid using JavaScript. It will work even if the user has JavaScript turned off. But it triggers on submit, not on blur.
Thanks for the points.
Thanks for the points.
http://jsfiddle.net/g0raydae/