我有一个生成库存项目列表的 php 页面,我想确定库存项目的表 td 是否为空,以便我可以运行一个 jquery 脚本来说明我们是否有库存项目。
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>");
}
})
我认为我应该在每次提交时都运行它,但不知道如何?