例:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function () {
$("#text1").bind("click", function () {
alert("text1点击时触发");
});
$("#text2").on("click", function () {
alert("text2点击时触发");
});
$("#text3").click(function () {
alert("text3点击获取值:" + $("#text3").val());
});
});
</script>
</head>
<body>
<input id="text1" type="button" value="点击1"/>
<input id="text2" type="button" value="点击2"/>
<input id="text3" type="text" value="love"/>
</body>
</html>
转载请注明出处:BestEternity亲笔。