How to check if a Textarea is empty in Javascript or Jquery?

Posted by streetparade on Stack Overflow See other posts from Stack Overflow or by streetparade
Published on 2010-03-19T10:13:18Z Indexed on 2010/03/19 10:21 UTC
Read the original article Hit count: 320

How do i check if a textarea contains nothing?

I tryed with this code

if(document.getElementById("field").value ==null)
{
    alert("debug");
    document.getElementById("field").style.display ="none";
 }

But it doesnt do what i expect. I expect that it should appear a messagebox "debug" and that the textarea is not shown.

How can i fix that issue?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery