请问这个语句在该例子中的作用:.$(this).attr("disabled","true");
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>unbind()移除绑定的事件</title>
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h3>unbind()移除绑定的事件</h3>
<input id="btntest" type="button" value="移除事件" />
<div>土豪,咱们交个朋友吧</div>
<script type="text/javascript">
$(function () {
$("div").bind("click",function()
{
$(this).removeClass("backcolor").addClass("color");
}).bind("dblclick",function()
{
$(this).removeClass("color").addClass("backcolor");
})
$("#btntest").bind("click",function(){
$("div").unbind("dblclick");
$(this).attr("disabled","true");//该语句不加对程序的实现没有影响,请问该语句放在这里是什么作用呢?
})
});
</script>
</body>
</html>CSS代码:
div
{
width: 160px;
border: solid 1px #ccc;
padding: 8px;
text-align: center;
}
.color
{
color: Orange;
}
.backcolor
{
background-color: Orange;
color: White;
}