title: open a jquerymobile popup programmatically in an if-statement
body: <p>I want to open a jquerymobile popup in an if-statement. If I run that page in my browser I get following error in my console: Uncaught TypeError: undefined is not a function.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>  &lt;!DOCTYPE html&gt;
      &lt;html&gt;
          &lt;head&gt;
              &lt;title&gt;PopUp&lt;/title&gt;
              &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
              &lt;link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.css"/&gt;
              &lt;script src="http://code.jquery.com/jquery-1.9.1.min.js"&gt;&lt;/script&gt;
              &lt;script src="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js"&gt;&lt;/script&gt;
              &lt;script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt;
  
      &lt;/head&gt;
       &lt;body&gt;
  
          &lt;body&gt;
              &lt;div data-role="page" data-theme="d"&gt;
                  &lt;div data-role="content"&gt;
                      On this page a popup should be opened programmatically
                      &lt;?php 
                          $simple = "simple";
                      ?&gt;
                      &lt;script type="text/javascript"&gt;
                          var simple = '&lt;?php echo $simple; ?&gt;';
                          $(document).ready(function(){
                              if(simple == "simple"){
                              $( "#myPopupDiv" ).popup( "open" );
                              }
                          });
                      &lt;/script&gt;
  
                      &lt;div data-role="popup" id="myPopupDiv"&gt;
                          &lt;p&gt;PopUp erfolgreich&lt;/p&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>What do I have to change in my code, to get the right result as intended?</p>