Skip to content

Instantly share code, notes, and snippets.

@Noah-Huppert
Last active December 26, 2015 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Noah-Huppert/7188566 to your computer and use it in GitHub Desktop.
Save Noah-Huppert/7188566 to your computer and use it in GitHub Desktop.
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<div class="clickOBJ">
OBJ 1
</div>
<div class="clickOBJ">
OBJ 2
</div>
<div class="clickOBJ">
OBJ 3
</div>
<div class="clickOBJ">
OBJ 4
</div>
<script>
$('.clickOBJ').click(function(){
alert(this.html());
});
//If you have the div with the text of OBJ 2 it would alert 'OBJ 2' and if you clicked on the div with
//the text of OBJ 4 it would alert 'OBJ 4'
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment