我是 JQuery 的新手,尽管多次阅读指南,但我找不到问题所在。
当我单击按钮时,以下功能不会被触发:
function enable(){
alert("Enable Working!");
}
function disable(){
alert("Disable Working!");
}
$("#enable").click(function(){
$("#enable").hide();
});
$("#disable").click(function(){
disable();
});
和html页面。我在这里也没有看到任何错误
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>popup</title>
<style>
#enable{
color:green;
position:relative;
top:20px;
}
#disable{
color:red;
position:relative;
top:25px;
}
body{
height: 100px;
}
</style>
</head>
<body id="popup">
<input id="enable" type="button" value="Enable">
<br />
<input id="disable" type="button" value="Disable">
<script src="popup.js"></script>
<script src="jquery.js"></script>
</body>
<html>
我想要的是enable
当我单击启用按钮时该功能运行。我希望disable
在单击禁用按钮时运行该功能。警报用于测试它是否正常工作。