This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
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 OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP 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
 
wood burning stoves
 
subject: How Can I Show a jQuery dialog after a hyperlink has been clicked