Last active
December 14, 2015 02:09
-
-
Save elijahmanor/5011216 to your computer and use it in GitHub Desktop.
jQuery Event Binding: Click/Bind
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div data-role="page"> | |
| <div data-role="header"> | |
| <h1>jQuery Board Members</h1> | |
| </div> | |
| <div data-role="content"> | |
| <ul id="members" data-role="listview" data-filter="true"> | |
| <li> | |
| <a href="index.html"> | |
| <h3>Scott González</h3> | |
| <p>jQuery UI Development Lead</p> | |
| </a> | |
| </li> | |
| <li> | |
| <a href="index.html"> | |
| <h3>Rick Waldron</h3> | |
| <p>jQuery Core</p> | |
| </a> | |
| </li> | |
| <li> | |
| <a href="index.html"> | |
| <h3>Dave Methvin</h3> | |
| <p>jQuery Core Lead & President</p> | |
| </a> | |
| </li> | |
| </ul> | |
| </div> | |
| <button id="addMember">Add Member</button> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $( document ).bind( "pageinit", function() { | |
| $( "#addMember" ).click( function() { | |
| var markup = '<li><a href="index.html"><h3>John Resig</h3><p>jQuery Core Lead</p></a></li>', | |
| $members = $( "#members" ); | |
| $( markup ).appendTo( $members ); | |
| $members.listview( "refresh" ); | |
| }); | |
| $( "#members li" ).click( function( e ) { | |
| e.preventDefault(); | |
| console.log( "Clicked " + $( this ).find( "h3" ).text() ); | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: jQuery Event Binding Bind Method | |
| description: jQuery Event Binding Example using the Bind Method | |
| authors: | |
| - Elijah Manor | |
| resources: | |
| - http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.css | |
| - http://code.jquery.com/jquery-1.8.2.min.js | |
| - http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js | |
| normalize_css: no |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment