Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8036743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:43:12+00:00 2026-06-05T02:43:12+00:00

Hi I have a form and on one input field I set a blur

  • 0

Hi I have a form and on one input field I set a blur event. A user leaves the input field, I validate it and then I decide if it is okay. If the value of the field is not okay I am alerting an information box. Anyway if the user hits a link to leave the page I cannot stop him. If a link is clicked by the user I have to prevent the default behaviour. How do I recognize by what event user has left the input field? Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T02:43:14+00:00Added an answer on June 5, 2026 at 2:43 am

    Have a look at this http://api.jquery.com/unload/

    As they says in the doc

    The unload event is sent to the window element when the user navigates
    away from the page. This could mean one of many things. The user could
    have clicked on a link to leave the page, or typed in a new URL in the
    address bar. The forward and back buttons will trigger the event.
    Closing the browser window will cause the event to be triggered. Even
    a page reload will first create an unload event.

    You can use this event to prevent users from navigating away from the page.

    Like this

    $(window).unload(function() {
      alert('You have unsaved form values.');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this field in one form : <input type=text name=promocode id=promoCode value= style=width:24%
I have a form with one textarea field. The field is set to accept
I have a form with field <input type=file name=file size=100 value=> if this field
I have a usual login form consisting of two input fields, one for login,
On a page that I'm designing I have a form with one input of
i have one form which have some input box and some select box. i
I have a form where depending on the website's brand one of two input
I have a form and one of the fields is a check-all-that-applies type field
I have a form, one of the fields is a select field, with 5
I am trying to set a hidden form field with the value of a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.