jQuery or Javascript: detecting if the text caret has left an element? -


is there way, via jquery or regular javascript, detect if user's text caret has moved out of element (such td, div, span, etc.)?

the scenario this: have table of textboxes grouped in pairs inside span element. performing validation on entries in pair not want validation errors pop until user has switched pair of textboxes (i.e. span).

perhaps i'm going wrong way, in mind i'm thinking perform validation on pair once user has switched out. need know when caret has moved on span element. can't rely on mouse position since user flick mouse pointer other location while making entries.

you can use loses focus event

<input type="text" onblur="myfunction()"> 

or

$("input").focusout(function(){     //do somthing; }); 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -