【问题标题】:How to check with jquery if this conent is null如果此内容为空,如何使用 jquery 检查
【发布时间】:2017-01-26 12:55:30
【问题描述】:

我有以下代码,如何使用 jquery 检查此内容是否为空?任何人都可以帮助我吗?

 .append("<div class='form-group'><textarea rows='5' class='input-text full-width description' >"+data.pi.description+"</textarea></div>")

【问题讨论】:

  • 您的意思是要检查data.pi.description 是否为空?
  • if (data.pi.description == null)

标签: jquery


【解决方案1】:

检查内容是否为空的多种不同方法。只需通过data.pi.description:

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

您可以使用以下命令检查 div 文本区域:

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

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

How to check null objects in jQuery类似的问题

【讨论】:

    猜你喜欢
    • 2015-10-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-04
    • 1970-01-01
    • 2014-02-12
    • 2013-04-27
    • 2014-02-27
    相关资源
    最近更新 更多