Saturday 15 June 2013

javascript - Click seems to be blocked by blur -


I have instructions which handle verification using bind from the blur event, as seen on this planker :

(valid input for first field is an email address, second field is 'yes')

Verification works, but to allow, validity () function Sometimes you have to click submit button button two times.

I narrow it down to some conversation between black and button; Possibly, if you have a blog on one of the two text fields, still waiting to blur the button, then only handles the stigma and not the click.

Is there a way to click it, I'm also calling Verification in the Click.

In my tests, I did not find any problems with my code However, if you actually have a There is a scenario in which there is a problem to click on the blur and button, you may have a variable that is starting validity and reset after verification is complete.

Actually, in your linking function on the instructions, the following are:

  // Keeps track of active verification var validation Inprogress = false; Function Declaration () {validationInprogress = true; // Validation code goes here (EMAIL_REGX.test (elm.val ())) {ctrl $ SetValidity ('email' is true); } And {ctrl. $ SetValidity ('email', wrong); } // After setting it, there are more than assumptions // The last statement in verification of this function should be Inprogress = false; }   

This is done once, before calling every dovalidation () , before checking whether a progress is already in progress - If not, just call.

  elm.bind ('blur', function () (if (accreditation progression) {scope $. Applicable (dovalidation);}}); radius. $ ('KickOffValidations', function () (If the (accreditation progress) {dovalidation ();}});   

Edit: Code with the above update.

No comments:

Post a Comment