dtl4521 2012-04-19 16:42
浏览 53
已采纳

如果<td>标签为空(无文本)...运行php列表页面的jquery脚本

I have a php page that generates a list of stock items and I want to determine if the table td for the stock items are empty so that I can run a jquery script that states that we either have the stock item or not.

jQuery(document).ready(function() {
    if ($("#paperId:empty")) {
        $('#tablebox').append("<h2 class=\"floatclear\">There is stock that matches your search parameters.</h2>");
    } else {
        $("table").hide();
        $('#papernav').hide();
        $('#tablebox').append("<h2 class=\"floatclear\">No Stock is currently available.</h2>");
    }
})

I think that I should be running this with every submit but don't know how?

  • 写回答

1条回答 默认 最新

  • doudaifu6083 2012-04-19 17:10
    关注

    there's no $("#paperId") in first place.

    When you generate the table, in each record add a class like 'papperID' and then count the length of the elements in the dom.

      $(".paperId").length
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序