In my websites I tried these 2 codes:
$(document).ready(function(){
$('.sendButton').attr('disabled', true);
$('#message').keyup(function() {
if ($(this).val().length != 0)
$('.sendButton').attr('disabled', false);
else
$('.sendButton').attr('disabled',true);
})
});
Then I tried this one:
$(document).ready(function(){
$('.sendButton').prop('disabled', true);
$('#message').keyup(function(){
$('.sendButton').prop('disabled', this.value == "" ? true : false);
})
});
How can I edit either of those so that my button isn't disabled when the only thing you do is right click paste in the textarea (#message)? With those codes it only works if you initially click it. I want the button to be disabled if there is no text in textarea, but at the same time I want it be enabled if it has text but there hasn't been an initial left click. Ie. the only thing you do when the page loads is right click, paste, then click button (and it should work).
Thanks in advance!
PS: both codes come from this topic: If input field is empty, disable submit button
onChangeevent instead of keyup.textarea (#message)