Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Ravish Srivastava
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code

needs to be inside the document.ready function.

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic