jQuery - blur or focusout event triggring twice solution

By yash → Wednesday, July 20, 2016

Problem: 

While working with one of the my project some input boxes needs to be validated on blur event. When i bind jQuery blur event with input, the blur event was calling twice.

Solution:

Use onblur event using input attribute. create a function and call it on blur

HTML:

<input type="text" onblur="validateInput(this.value)" />

JavaScript:


function validateInput(val){
  // Do whatever you want to do on blur event
  console.log(val);
}

Preview

See the Pen jAzEKr by Yashwant Patel (@yashwant) on CodePen.


Download Source
Yashwant Patel

No Comment to " jQuery - blur or focusout event triggring twice solution "