function - jQuery dialog button confirm before opening URL -


i having difficulty creating button pop dialog box 'confirm' if want continue open url link or not. however, when click on button "google', automatically directs me google website before clicked "ok" view. dont know doing wrong.

you can view jsfiddle here: http://jsfiddle.net/urgjd/76/

html:

<button class="open" onclick="window.open('http://google.com')">google</button>  <div class="unique">are sure want continue?</div> 

js:

$(function() {     $('.open').on("click", function(e) {         var link = this;          e.preventdefault();          $('.unique').dialog({             buttons: {                 "ok": function() {                     window.location = link.href;                 },                 "cancel": function() {                     $(this).dialog("close");                 }             }         });     }); }); 

css:

.unique {display: none;} 

thank in advanced!

<button class="open">google</button>

remove onclick event <button>.

also, creating jqueryui dialog. need need open it. suggest looking @ jqueryui documentation widget.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -