Show confirm dialog to leave page - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:jQuery Method Example

Description

Show confirm dialog to leave page

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
 </head> //from   w  w  w .j a  v  a  2 s . c o  m
 <body> 
  <a onclick="confirm('Leave?') || event.preventDefault()" href="http://en.wikipedia.org">Wikipedia</a>  
 </body>
</html>

Related Tutorials