-1

In the first run we do this:

$(document)
    .off('pagecreate','#MAT1000P00')
    .on('pagecreate','#MAT1000P00', function() {
        $(document)
           .off('click','#MAT1000P00-listview li')
           .on('click','#MAT1000P00-listview li', function() {....

for our first page. Now we want a function to do this on any page like this:

$(document)
    .off('pagecreate')
    .on('pagecreate',function (event,ui) {
        var activePage = $.mobile.pageContainer.pagecontainer("getActivePage");
        var activePageId = activePage[0].id;
        $(document)
            .off('click', '#' + activePageId + '-listview li')
            .on('click', '#' + activePageId + '-listview li', function() {...

but the new code doesn't work... why?

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
Dirk Kolbe
  • 59
  • 6

1 Answers1

1

Now we found a solution to globalize our function. We change the document-Element as ID to the mobile-container and now it will be run:

$(document)
.on('pagecreate',function (event,ui) {
    $(':mobile-pagecontainer').on('click','li',function() {....
Dirk Kolbe
  • 59
  • 6
  • 1
    Use the "edit" link under your question to add information... Answers should be answers – apaul Feb 11 '15 at 23:29