Check input of form field - if postcode exists, alert javascript -


need append script text field in 'enter postcode' field, actively check content , pop alert. blacklisting postcodes, basically.

here have:

html:

<input type="text" maxlength="20" size="25" value="" name="zipc" id="zipc"> 

js:

jquery("#zipc").ready(function () {     function bfpo(t) {         if (t.value.match(/\"bf1 3aa"/g)) {             alert('we cannot send parcels bfpo addresses. ever.');             t.value = t.value.replace(/\s/g,'');         }     } }); 

now, i'm aware doesn't work how 'ready' alert when select next field type in? perhaps use of indexof()?

any great , in advance.

i think can use focusout function. check out

focusout jquery

and can use blur() function well

$('#textfieldid').blur(function() {   //logic }); 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -