I have one question I try to execute a event on page url using data-name but the event not execute.
$$(document).on(‘page:init’, ‘.page[data-name=“page2”]’, function (e) {
// Do something here when page with data-name=“page2” attribute loaded and initialized
console.log(‘Execute on page init’); // not executed
})
This should work without problems, just checked it
I’m on version 2.0.10 and I have this expression for example. Is it correct?
<div id="page1" class="page" data-name="pg1">
<div class="page-content">
<h1>Test</h1>
</div>
</div>
$$(document).on(‘page:init’, ‘.page[data-name=“pg1”]’, function (e) {
console.log(‘Execute on page init’); // not executed
})
Tks
Yes, correct, but only if it is not a home page