Possible Duplicate:
Disable submit button on form submit
I have a question about disable button after ajax submit. Actually the button disabled first until I input text to textarea. Then if I submit with click button, it must disable the button.
In my actual, after click button, the button isn't disabled.
Here it's my JS code :
$(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"/>
Now what I want to do is, disabled the button after submit. Any idea ?