 <p><code>if(!($('textarea').val().length == 0))</code> will work if you have only one <code>textarea</code> element in your page. I think what you were trying to do with that <code>:name</code> selector was select a specific <code>textarea</code> based on its name, in which case you need:</p> <p><code>$('textarea[name=yourName]')</code></p>