Thursday, August 9, 2012

JQM: 'pageinit' & 'pagechange' Events

jQuery Mobile has many events associated with a page. Here we will discuss about the difference between 'pageinit' and 'pagechange' events. When a page is displayed for the first time 'pageinit' event will be fired. 'pagechange' event also fires here and for every page change. When we move from say page1 to page2 where page2 was not displayed before, 'pageinit' event will be fired. 'pagechange' event will also get fired since we changed the page from page1 to page2.

When we move from page2 to page1, where page1 was displayed previously, only 'pagechange' will be fired.