Detect content in textarea (jQuery)
Question
How do I check if there's any content in <textarea>
? I need to addClass based on that condition.
Many thanks
Solution
if($.trim($('textarea').val()).length){
$(this).addClass('someclass');
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow