为什么我的fadeToggle不适用于红色框?

时间:2017-06-26 06:06:37

标签: javascript jquery html css

当我点击它支持的按钮淡入和淡出红色按钮时,但它不是那么问题是什么?

我的代码:

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  ${"button").click(function(){
  $("div").fadeToggle();
  });

});
</script>
</head>
<body>
 <button>Click Here To FadeToggle</button><br><br>
 <div style="width:80px;height:80px;background-color:red;"></div>
</body>
</html>

1 个答案:

答案 0 :(得分:1)

更改:

${"button")
 ^---------------

$("button")
 ^---------------

&#13;
&#13;
$(document).ready(function(){
  $("button").click(function(){
  $("div").fadeToggle();
  });
});
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<button>Click Here To FadeToggle</button><br><br>
<div style="width:80px;height:80px;background-color:red;"></div>
&#13;
&#13;
&#13;