Monday 15 February 2010

Jquery form validator: Unexpected identifier -


I am working with a basic jquery form validator for learning purposes. Every time I run a page in my browser, I get a unexpected identifier error, I've seen the code several times to check whether it is a quotation issue, but there is no luck . How can I get rid of that error?

script.js

  $ (document) .ready (function () {$ ("# myform"). Submit (function ) {Var abort = false; $ ("div.error"). Remove (); $ (": input [required]"). Each (function () {if ($ (this) .val () === ("Quote; div class = \" error \ "& gt; This is a required field & lt; / div & gt;); abort = true;}}); if (abort) {return false;} other { PostData = $ ("# myform"). Serialize (); $ .post ("process.php", PostData + "and Action = Submit and Accept Request = 1", function (msg) {if (Msg) {$ ( $ ("Input [placeholder]"). Blur (function () {$ ("div" .tar "(); var myPattern = $ (this) .attr (" pattern "); var myplaceholder = $ (this) .attr (" placeholder "); var isvalid = $ (this) .val () Search (myPattern)> gt; = 0; if (IsValid) is {$ (this). Focus (); $ (this) ("& lt; div class = \" error \ "& gt; entered The data does not match the expected pattern: "+ myPlaceholder +"  ");} // isValid test}); // onblur   

Enter image details here < / Div>

PostData should be declared with var, but this is not a problem Or is incorrectly placed from;

I think the blur function is also inside $ .ready (function () {block? , because its possible JQuery does not work when To

No comments:

Post a Comment