How to open a Dialogue Box On Page Load

前端 未结 3 1005
粉色の甜心
粉色の甜心 2021-01-26 09:51

I am trying to open a Dialogue Box On page load of jquery Mobile screen .Right now i am able to open Dialogue Box on button Click .I want the Dialogue box to get pop up automati

相关标签:
3条回答
  • 2021-01-26 10:32

    You can fire the click in your jquery code as

    $('#simplestring').click();
    

    Write this statement on page load. It will fire click from inside your code and as the click handler does, it will open the dialog :)

    0 讨论(0)
  • 2021-01-26 10:39

    Try using $(document).ready(function(){})

    $(document).ready(function()
    {
      $("#simplestring").simpledialog({
        'mode' : 'string',
        'prompt' : 'Please Enter Your Mobile No.',
        'buttons' : {
          'OK': {
            click: function () {
              $('#dialogoutput').text($('#dialoglink').attr('data-string'));
    
              //get the Value Entered 
              //Create a Sqlite Database and table 
              //Insert it there 
    
            }
          },
          'Cancel': {
            click: function () { },
            icon: "delete",
            theme: "c"
          }
        }
      })
    });
    
    0 讨论(0)
  • 2021-01-26 10:43
    function onLoad() 
    { 
      openDialogBox();  
      document.addEventListener("deviceready", onDeviceReady, false);
      $("#searchby_chooser_ok_button").bind ("click", searchByCriteria); 
    
     if (typeof Contact === "undefined") {
        getElement("contacts_list").innerHTML = "<p>The Cordova Contacts API is  inaccessible</p>";
     }
    }
    
    function openDialogBox()
    { 
      $("#simplestring").simpledialog({
        'mode' : 'string',
        'prompt' : 'Please Enter Your Mobile No.',
        'buttons' : {
        'OK': {
           click: function () {
             $('#dialogoutput').text($('#dialoglink').attr('data-string'));
           }
         },
         'Cancel': {
           click: function () { },
           icon: "delete",
           theme: "c"
          }
         }
       })
     } 
    
    0 讨论(0)
提交回复
热议问题