validation - JQuery - grab corresponding event of blur-Action -


hi have form , on 1 input field set blur event. user leaves input field, validate , decide if okay. if value of field not okay alerting information box. anyway if user hits link leave page cannot stop him. if link clicked user have prevent default behaviour. how recognize event user has left input field? in advance.

have @ http://api.jquery.com/unload/

as says in doc

the unload event sent window element when user navigates away page. mean 1 of many things. user have clicked on link leave page, or typed in new url in address bar. forward , buttons trigger event. closing browser window cause event triggered. page reload first create unload event.

you can use event prevent users navigating away page.

like this

$(window).unload(function() {   alert('you have unsaved form values.'); }); 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -