javascript - Multiple level of jQuery Dialog -


i trying implement multiple level of jquery dialog modal behavior. have main page open first dialog box second dialog box can open both should modal box.

first issue getting error on fiddle when clicking main page link , second not creating dialog required.

fiddle

a bunch of things going on:

  1. in jsfiddle, need add jquery ui , theme external resources. selecting jquery library not enough. jquery ui dialog part of jquery ui library, not part of jquery core library.

  2. since click events on <a> tags, need cancel default behaviour. make click handler <a> tags, , cancel default behaviour first before doing else:

    <a href="#" id="clickforgold">gold</a>  $("#clickforgold").on("click", function(e) {   e.preventdefault();   <--- stops link navigating   //now other stuff }); 
  3. set dialogs @ page load, , open them when need to. use autoopen:false parameter keep them opening when page loads. open them follows:

    $("dialog-id").dialog("open"); 
  4. don't open modal on modal. it's extremely poor usability. close first 1 before opening second one:

    function clickforsecond() {   $("dialog-id-first").dialog("close");   $("dialog-id-second").dialog("open"); } 

a working example: https://jsfiddle.net/5ucat3f7/1/


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -