SimpleModal -- Open OnLoad

Posted by Bill Griffith on Stack Overflow See other posts from Stack Overflow or by Bill Griffith
Published on 2010-02-16T15:22:11Z Indexed on 2010/06/17 7:03 UTC
Read the original article Hit count: 370

Filed under:
|
|
|

I'm new to JQuery -- not new to javascript.

Was able to open the OSX STYLE DIALOG using the hyperlink button provided in the demo index.html page, but would like to open it on the page load. I read a couple links on StackOverflow (http://stackoverflow.com/questions/1611727/how-do-i-invoke-a-simplemodal-osx-dialog-on-page-load), but still could not get it to work in the exact same index.html page. I finally resorted to a stopgap measure by programmatically invoking the button click of a hidden button element -- see following fragment:

onLoad="document.getElementById('load_OSX_Example').click();">
<input type="hidden" id="load_OSX_Example" value="" class='osx'>

<script type="text/javascript" language="javascript">
    //#### open the OSX Modal  ##########
    $(document).ready(function(){
       $("#osx-modal-content").modal();
    });
</script>

So I have two questions:

  1. How can you invoke the class='osx' using javascript/html programmatically?
  2. Why won't this work using the $("#osx-modal-content").modal(); call in javascript (see fragment above)? I tried this in multiple browsers, and the only content that displayed on the screen was content of this tag: "div id="osx-modal-title", and there was no error in the jscript console.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about plugin