我是JQuery的新手,儘管多次閱讀指南,但我找不到問題。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
函數在單擊禁用按鈕時運行。警報在那裏測試它是否正常工作。
什麼是不工作?你想做什麼? – putvande
@ user2465313,明確你的問題... –
我們不能確切地告訴你,不知道什麼不工作,但應該把查詢源放在你的腳本之前。這可能是錯誤的來源 – romainberger