<style type="text/css">
#thebutton { width: 100px; background-color: #eee; text-align: center;
padding: 10px; cursor: pointer; }
#thebutton.activated { font-weight: bold;}
#thebutton.hovering { color: Blue; }
#thebox { background-color: #eee; position:relative; width: 300px; height: 200px;
padding: 10px; top: 5px; display: none;}
</style>
<script type="text/javascript">
$(document).ready(function()
{
$("#thebutton").click(function() {
var currentValue ;
$.ajax({
type: "post",
url: "checklikes",
//data: "user="+name.val(),
success: function(msg)
{
$("#replies").html(msg)
.fadeIn("fast");
currentValue=parseInt(msg)+1;
$("#test").html(currentValue)
.fadeIn("fast");
var data1= $("#test").text();
$.ajax({
type: "post",
url: "checkupdate",
data: "user="+data1,
success: function(msg)
{
$("#t").html(msg)
.fadeIn("fast");
$("#thebutton").toggleClass("activated");
$("#thebutton").hasClass("activated") ? $("#thebox").fadeIn():
$("#thebox").fadeOut();
$(this).attr('disabled','disabled');
}
});
}
});
});
});
<body>
<div id="thebutton">Click me!</div>
<div id="thebox" style="display:none;">Content goes here</div>
</body>
單擊該按鈕後,我想禁用它,但它不起作用。取而代之的禁用div id後單擊
$("#thebutton").click(function() {
你忘了提問了。 – BoltClock 2011-03-20 09:12:37
你有問題。所以,我不知道這是否是答案:
Woah,有些改變與編輯的問題有沒有我們?!?!? – simnom 2011-03-20 09:22:16