• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
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



 
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
 
Never trust an airline that limits their passengers to one carry on iguana. Put this tiny ad in your shoe:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!