Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit 3fa57c7

Browse files
Docs: replaced live() by on().
1 parent 5c9cd8b commit 3fa57c7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/api/events.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ <h1>Events</h1>
2525
<div data-role="content">
2626
<div class="content-primary">
2727

28-
<p>jQuery Mobile offers several custom events that build upon native events to create useful hooks for development. Note that these events employ various touch, mouse, and window events, depending on event existence, so you can bind to them for use in both handheld and desktop environments. You can bind to these events like you would with other jQuery events, using <code>live()</code> or <code>bind()</code>.</p>
28+
<p>jQuery Mobile offers several custom events that build upon native events to create useful hooks for development. Note that these events employ various touch, mouse, and window events, depending on event existence, so you can bind to them for use in both handheld and desktop environments. You can bind to these events like you would with other jQuery events, using <code>on()</code> or <code>bind()</code>.</p>
2929

3030
<div class="ui-body ui-body-e">
3131
<h4 style="margin:.5em 0">Important: Use <code>$(document).bind('pageinit')</code>, not <code>$(document).ready()</code></h4>
@@ -419,11 +419,11 @@ <h2>Page transition events</h2>
419419

420420
<p>You can access the <code>prevPage</code> or <code>nextPage</code> properties via the second argument of a bound callback function. For example: </p>
421421
<pre><code>
422-
$( 'div' ).live( 'pageshow',function(event, ui){
422+
$( 'div' ).on( 'pageshow',function(event, ui){
423423
alert( 'This page was just hidden: '+ ui.prevPage);
424424
});
425425

426-
$( 'div' ).live( 'pagehide',function(event, ui){
426+
$( 'div' ).on( 'pagehide',function(event, ui){
427427
alert( 'This page was just shown: '+ ui.nextPage);
428428
});
429429
</code></pre>
@@ -439,14 +439,14 @@ <h2>Page initialization events</h2>
439439
<dd>
440440
<p>Triggered on the page being initialized, before most plugin auto-initialization occurs.</p>
441441
<pre><code>
442-
$( '#aboutPage' ).live( 'pagebeforecreate',function(event){
442+
$( '#aboutPage' ).on( 'pagebeforecreate',function(event){
443443
alert( 'This page was just inserted into the dom!' );
444444
});
445445
</code></pre>
446446
<p>Note that by binding to <code>pagebeforecreate</code>, you can manipulate markup before jQuery Mobile's default widgets are auto-initialized. For example, say you want to add data attributes via JavaScript instead of in the HTML source, this is the event you'd use.</p>
447447

448448
<pre><code>
449-
$( '#aboutPage' ).live( 'pagebeforecreate',function(event){
449+
$( '#aboutPage' ).on( 'pagebeforecreate',function(event){
450450
// manipulate this page before its widgets are auto-initialized
451451
});
452452
</code></pre>
@@ -456,7 +456,7 @@ <h2>Page initialization events</h2>
456456
<dd>
457457
<p>Triggered when the page has been created in the DOM (via ajax or other) but before all widgets have had an opportunity to enhance the contained markup. This event is most useful for user's wishing to create their own custom widgets for child markup enhancement as the jquery mobile widgets do.</p>
458458
<pre><code>
459-
$( '#aboutPage' ).live( 'pagecreate',function(event){
459+
$( '#aboutPage' ).on( 'pagecreate',function(event){
460460
( ":jqmData(role='sweet-plugin')" ).sweetPlugin();
461461
});
462462
</code></pre>
@@ -466,7 +466,7 @@ <h2>Page initialization events</h2>
466466
<dd>
467467
<p>Triggered on the page being initialized, after initialization occurs. We recommend binding to this event instead of DOM ready() because this will work regardless of whether the page is loaded directly or if the content is pulled into another page as part of the Ajax navigation system.</p>
468468
<pre><code>
469-
$( '#aboutPage' ).live( 'pageinit',function(event){
469+
$( '#aboutPage' ).on( 'pageinit',function(event){
470470
alert( 'This page was just enhanced by jQuery Mobile!' );
471471
});
472472
</code></pre>

0 commit comments

Comments
 (0)