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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Test</title> | |
<script src="//code.jquery.com/jquery-1.7.2.js"></script> | |
<script> | |
$(document).ready(function () { | |
$('.inputClass').keyup(function (e) { | |
alert(e.keyCode); | |
}); | |
$('#MyDiv input').keyup(function (e) { | |
alert(e.keyCode); | |
}); | |
$('#myButton').button().click(function (e) { | |
alert('Button click activated!'); | |
}); | |
$('#myText').live("keypress", function (e) { | |
if (e.keyCode == 13) { | |
alert("Enter pressed"); | |
} | |
}); | |
$('img#myImg').click(function () { | |
$(this).css('border', "solid 2px red"); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<form action="#"> | |
<button id="myButton">My Button</button> | |
<input type="text" id="myText" class="inputClass" /> | |
<div id="MyDiv"> | |
<input type="text" id="DynamicID" class="myClass" /> | |
</div> | |
<div> | |
<a> | |
<img id="myImg" src="http://jsfiddle.net/img/logo.png" /></a> | |
</div> | |
</form> | |
</body> | |
</html> |