I'm trying to disable the submit button after the user submits a form.
here is my js
$('.dDisable').click(function(){
var value = $('.chars').val();
var chars = value.length;
if (chars<10){
$(".dDisable").submit(function(e){
$('.chars').css('border','1px solid red');
return false;
});
}
else{
$('.dDisable').one('submit', function() {
$(this).find('input[type="submit"]').attr('disabled','disabled');
$(this).css('opacity','0.5');
});
}
});
For some reason when the user clicks on the submit button the textarea (.chars) gets a red border and then whole form (.dDisable) gets an opacity of 0.5
Here is http://jsfiddle.net/#&togetherjs=UlcR8bJwIM
for some reason it seems like working but the form doesn't get send.