*
The moose likes HTML, CSS and JavaScript and the fly likes How Can I Show a jQuery dialog after a hyperlink has been clicked Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How Can I Show a jQuery dialog after a hyperlink has been clicked" Watch "How Can I Show a jQuery dialog after a hyperlink has been clicked" New topic
Author

How Can I Show a jQuery dialog after a hyperlink has been clicked

Ravish Srivastava
Greenhorn

Joined: Sep 05, 2011
Posts: 23
Hi,

How can I show a JQUERY dialog after a hyperlink has been clicked. The Dialog has a button say "Ok". If I press a button "Ok", the request should go to link mentioned.

Below is the my JQUERY CODE inside my JSP:

$(document).ready(function(){
$( "#dialogform1" ).dialog({
autoOpen: false,
height: 300,
width: 450,
resizable: false,
buttons: {
"Ok": function(){
$(this).dialog('close');
window.location.href = link.attr('href');
}
}
});

$('#opener').click(function(){
$('#dialogform1').dialog("open");
});


HTML link Code in JSP:
<a id="opener" href="google.com">Download Item List</a>

When i click the above link, i should get a POP up having "Ok" button and when i press the "Ok" button google.com link sholud open and pop should close otherwise my pop reamins open.


RS



Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
The code

needs to be inside the document.ready function.

Eric
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How Can I Show a jQuery dialog after a hyperlink has been clicked
 
Similar Threads
How to display the popup on the button click using Jquery
Grails Tutorials Available.
Value in the textarea is not retaining in jquery popup modal.
Creating a masked popup in JavaScript
Jquery Event Sequence