-5

I have the following code , how can I check if this content is null with jquery ? Could anyone help to me ?

 .append("<div class='form-group'><textarea rows='5' class='input-text full-width description' >"+data.pi.description+"</textarea></div>")
Filburt
  • 17,626
  • 12
  • 64
  • 115
jc1992
  • 644
  • 3
  • 10
  • 24

1 Answers1

0

A bunch of different ways to check if content is null. Just by the data.pi.description:

if (! data.pi.description) ...

You could check the div text area with:

if (!$(".description").html()) ....

or

if ( $(".description").length == 0) ...

Similar question to How to check null objects in jQuery

Community
  • 1
  • 1
Matz
  • 371
  • 1
  • 2
  • 5