pageinit does not fire in jquery

38 Views Asked by At

Can anyone help with this?

The pageinit does not fire!

JS

$(document).off("pageinit pageshow", "#fachub").on("pageinit", "#fachub", function() {

    alert("Hello");

});

HTML

<html>
    <head>
     <script src="../js/script.js"></script>

    </head>

    <body>
        <div data-role="page" class="jqm-demos jqm-home jqm-cori carehub" data-theme="c" id="fachub">
            <h3 id="appendtoh3">Facilities Hub</h3>
        </div>
        <!-- /page -->
    </body>

</html>

When i load the page on the browser i do not get any alerts at all, it is just the blank page.

1

There are 1 best solutions below

0
jcarrera On

Try using pagecreate instead of pageinit. The documentation says that pageinit was deprecated in jQM 1.4.0.

$(document).off("pagecreate pageshow", "#fachub").on("pagecreate", "#fachub", function() {

    alert("Hello");

});