Posted on 2009-12-22
Last Modified: 2012-05-08
how to change this function into jquery?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  "">



<title>Untitled Document</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<meta http-equiv="Content-Style-Type" content="text/css">

<meta http-equiv="Content-Script-Type" content="text/javascript">

<script type="text/javascript">

window.onbeforeunload = function (evt) {

  var message = 'Are you sure you want to leave?';

  if (typeof evt == 'undefined') {

    evt = window.event;


  if (evt) {

    evt.returnValue = message;


  return message;








Open in new window

Question by:yingwho
    1 Comment
    LVL 22

    Accepted Solution


    I do not see any event supported by them

    So do not think its feasible. what you have is proper.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    by Julian Matz As of jQuery ( 1.4 the .live() method ( supports custom events as well as some standard JavaScript events that it previously didn't support. Among these is the submit event. Unlike …
    In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
    The viewer will learn how to dynamically set the form action using jQuery.
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now