Created
August 18, 2016 17:01
-
-
Save brianpetro/aa3e1dc164645c5b74deb2fbba3af999 to your computer and use it in GitHub Desktop.
This file contains 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
<!-- correct way to bind event in jquery --> | |
<ul class="menu-list"> | |
<li class="menu-item">menu 1</li> | |
<li class="menu-item">menu 2</li> | |
<li class="menu-item">menu 3</li> | |
</ul> | |
<script> | |
$('.menu-item').on('click', function () { | |
var menuText = $(this).text(); | |
alert(menuText); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment