title: Calling a modal windows in a conditional statement
body: <p>I've got this script which works on a click of button, it pops up a modal window with a faded background. What i want to achieve this time is to include it in a conditional statement, the later part of my script is as below</p>
  
  <pre><code> if (result != $version) { alert ('Your version is out of date') } } })
  alert ('You are welcome back')
  </code></pre>
  
  <p>But i want to change the alert to a modal windows but can't find my way through</p>
  
  <pre><code>// JavaScript Document
  
  
  $(document).on("pagecreate", function () {
      $(".about").on("click", function () {
          // close button
          var closeBtn = $('&lt;a href="#" data-rel="back" class="ui-btn-right ui-btn ui-btn-b ui-corner-all ui-btn-icon-notext ui-icon-delete ui-shadow"&gt;Close&lt;/a&gt;');
  
          // text you get from Ajax
          var content = "&lt;p&gt; hello folks, good evening&lt;/p&gt;";
  
          // Popup body - set width is optional - append button and Ajax msg
          var popup = $("&lt;div/&gt;", {
              "data-role": "popup"
          }).css({
              width: $(window).width() / 0 + "px",
              padding: 5 + "px"
          }).append(closeBtn).append(content);
  
          // Append it to active page
          $.mobile.pageContainer.append(popup);
  
          // Create it and add listener to delete it once it's closed
          // open it
          $("[data-role=popup]").popup({
              dismissible: false,
              history: false,
              theme: "b",
              /* or a */
              positionTo: "window",
              overlayTheme: "b",
              /* "b" is recommended for overlay */
              transition: "pop",
              beforeposition: function () {
                  $.mobile.pageContainer.pagecontainer("getActivePage")
                      .addClass("blur-filter");
              },
              afterclose: function () {
                  $(this).remove();
                  $(".blur-filter").removeClass("blur-filter");
              },
              afteropen: function () {
                  /* do something */
              }
          }).popup("open");
      });
  });
  </code></pre>