通过本文主要向大家介绍了jQuery,bind(),方法,用法等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
本文实例讲述了jQuery中bind()方法用法。分享给大家供大家参考。具体分析如下:
此方法为匹配元素的特定事件绑定事件处理方法。
在语法上bind()方法和one()方法是一样的,它们的不同在于绑定的处理方法的执行次数。
语法结构一:
参数列表:
实例代码:
<!DOCTYPE html>
<html>
<head>
<meta charset=" utf-8">
<meta name="author" content="http://www.jb51.net/" />
<title>bind()函数-</title>
<style type="text/css">
div{
width:100px;
height:100px;
border:1px solid blue;
}
</style>
<script type="text/javascript" src="mytest/jQuery/jquery-1.8.3.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("div").bind("click",function(){$("div").css({color:"green",fontSize:"20px"})});
})
</script>
</head>
<body>
<div>欢迎您</div>
</body>
</html>
语法结构二:
参数列表:

