Skip to content

Commit

Permalink
Merge pull request jquery-archive#2767 from easymovet/patch-1
Browse files Browse the repository at this point in the history
Corrected .delegate() syntax for 'pagecreate' code example
  • Loading branch information
gseguin committed Oct 21, 2011
2 parents 4e1c898 + 3e9e0d5 commit 769d3e1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/pages/page-scripting.html
Expand Up @@ -40,15 +40,15 @@ <h2>pagecreate = DOM ready</h2>

<p>The <code>pagecreate</code> event is triggered on a page when it is initialized, right after initialization occurs. Most of jQuery Mobile's official widgets auto-initialize themselves based on this event, and you can set up your code to do the same.</p>
<pre><code>
$( document ).delegate( "pagecreate", "#aboutPage", function() {
$( document ).delegate("#aboutPage", "pagecreate", function() {
alert('A page with an ID of "aboutPage" was just created by jQuery Mobile!');
});
</code></pre>

<p>If you'd like to manipulate a page's contents <em>before</em> the pagecreate event fires and widgets are auto-initialized, you can instead bind to the <code>pagebeforecreate</code> event:</p>

<pre><code>
$( document ).delegate( "pagebeforecreate", "#aboutPage", function() {
$( document ).delegate("#aboutPage", "pagebeforecreate", function() {
alert('A page with an ID of "aboutPage" is about to be created by jQuery Mobile!');
});
</code></pre>
Expand Down

0 comments on commit 769d3e1

Please sign in to comment.