Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/453.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用jquery更改表td样式_Javascript_Jquery_Html Table - Fatal编程技术网

Javascript 使用jquery更改表td样式

Javascript 使用jquery更改表td样式,javascript,jquery,html-table,Javascript,Jquery,Html Table,我有jquery附加表。在这种情况下,我使用CSSstyle=“display:none”隐藏了初始行的列,并且在某些事件之后,我希望显示该列 my table id is-#148 tr id is -row1 我想改变tr的第一个td风格。 我参考了很多这方面的内容,但没有得到正确的解决方案 争吵是 <tr id="trid1"><td style="display:none"><input type="submit" class="btn btn-suc

我有jquery附加表。在这种情况下,我使用CSS
style=“display:none”
隐藏了初始行的列,并且在某些事件之后,我希望显示该列

my table id is-#148
tr id is -row1
我想改变tr的第一个td风格。 我参考了很多这方面的内容,但没有得到正确的解决方案

争吵是

 <tr  id="trid1"><td style="display:none"><input type="submit" class="btn btn-success"  onclick="choose(2,<?php echo $loop->us_id;?>);"></td><td> <button class="btn btn-info btn-labeled fa fa-plus fa-lg" id="us_id" onclick="fun(<?php echo $loop->us_id;?>)" >Add Task</button></td></tr>

这可能有用。

试试这个

$(function(){
   //$('table').find('td').eq(0).show();

  // or

  //$('table').find('td:nth-child(1)').show();

  // or

  $('table').find('td:first-child').show();
});

可能
$('trid1td:eq(0)')。show()
?然而,隐藏/显示表格单元格是出了名的不可靠。如果可能的话,我会避免这样做<代码>:first child
在这种情况下是可选的。我添加了
:first child
,以防行中添加更多的单元格。嗯。。。是的,对于有效的机制,你是对的。
$(function(){
   //$('table').find('td').eq(0).show();

  // or

  //$('table').find('td:nth-child(1)').show();

  // or

  $('table').find('td:first-child').show();
});