Welcome,
I have textarea and i have small function what allow me to submit message on enter keypress.
$(function(){
$('input').keydown(function(e){
if (e.keyCode == 13) {
$(".sender").click();
return false;
}
});
});
That's work fine, i mean great :)
Next, i want disallow sending empty form. So i was thinking it will be a easy task.
var tag = $("#mytextarea").val();
if(tag.length<1 )
{
//empty
}
else
{
//not empty
}
But it's not working. I also try val=='' I think it count that enter what user hit to send form ;) I was trying alert value, but i got only that enter...
So, how can i check if is empty or not, but counting enter, like empty. If only enter will be found, threat like empty space val==''
Regards