gpt4 book ai didi

javascript - 使用 Jquery 隐藏表 td

转载 作者:行者123 更新时间:2023-11-30 08:50:20 25 4
gpt4 key购买 nike

在下面的代码中,如何隐藏表格的 id 列。

var joblist = "";
joblist = joblist + "<table ><tr><th >Select</th><th id='td_1'>ID</th><th >Name</th><th >Names</th><th>OS</th><th >Server</th></tr>";

var tabString = '<tr ><td > ' + '<input type="radio" name="joblist" onclick="myfunc(this);" id= ' + value.jobid + 'value=' + value.jobid + '> </td><td id="td_1" >' + value._id + '</td><td >' + value.names + '</td><td a>' + value.os + '</td><td >' + value.server + '</td></tr>';

joblist = joblist + tabString;

我试过了

$("#td_1").hide()

但它不起作用。还有其他解决方案吗?

最佳答案

首先,如果有多个 td,则不要使用相同的 id,在这种情况下,添加一些其他的 post 或 pre。并用作

 $('[id^="td_1"]').hide();//for post
$('[id$="td_1"]').hide();//pre

试试这个

 $('[id="td_1"]').hide();

关于javascript - 使用 Jquery 隐藏表 td,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18463591/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com