我有阿賈克斯後提交關於關閉按鈕的問題。 實際上,按鈕先禁用,直到我輸入文本到textarea。然後,如果我點擊按鈕提交,它必須禁用按鈕。
在我的實際中,點擊按鈕後,按鈕沒有被禁用。
這是我的JS代碼:
$(function()
{
$("#submit_h").click(function()
{
var haps = $("#haps").val();
var dataString = 'haps='+ haps;
if(haps=='')
{
alert('Please type your haps');
}
else
{
$.ajax({
type: "POST",
url: "post_haps.php",
data: dataString,
cache: false,
success: function(html){
$("#haps").val('');
$("#content").prepend(html);
}
});
}return false;
});
});
-
<textarea id="haps"></textarea>
<input type="submit" class="button inact" value="Share" disabled="disabled" id="submit_h"/>
現在我想做的是,禁用按鈕後提交。 有什麼想法?
http://stackoverflow.com/questions/5691054 /禁用 - 提交按鈕 - 表單提交 – NullUserException