JR Galia
JR Galia

Reputation: 17269

JQuery Mobile pageinit for Two Pages

I already below for JQM page with id page1:

$('#page1').live('pageinit', function(event, data){

});

If I have another JQM page with id page2 and want to have the same pageinit with page1, how to call it or add the event without copying all the code at page1 pageinit event.

Upvotes: 0

Views: 57

Answers (2)

Stefan
Stefan

Reputation: 832

I think it will be triggered only once in a multi-page template.

See page load events and page change events: http://jquerymobile.com/test/docs/api/events.html

Upvotes: 0

user700284
user700284

Reputation: 13620

$('#page1,#page2') should do the trick.

Pls refer - http://api.jquery.com/multiple-selector/

Upvotes: 2

Related Questions