【问题标题】:Hide multiple selected rows with jquery使用jquery隐藏多个选定的行
【发布时间】:2014-03-15 00:43:19
【问题描述】:

您好,我有一个由 mysql 查询填充的表,第一列中有一个复选框。

while ($dsatz = mysql_fetch_assoc($res)) {        
    echo '<tr>';
    echo '<td style="width: 3%;"><input type="checkbox" name="checkbox[' . $lf . ']"/></td>';
    echo '<td style="width: 19%;"><strong>' . $dsatz["name"] . '</strong></td>';
    echo '</tr>';
    $lf = $lf + 1;
} 

我想通过单击表格底部的链接/按钮来隐藏所有选定的行。

这应该可以通过 css (display: none) 和 jquery 实现。但是我该怎么做呢?

感谢您的帮助! 赛博

【问题讨论】:

标签: javascript jquery html mysql css


【解决方案1】:

你可以试试

$('yourbutton').click(function(){
    $('#yourtable tr').has('input[type="checkbox"]:checked').hide()
})

【讨论】:

  • 所以对于我们中间的愚蠢者(包括我)来说,这将是:$('hide1').click( function(){ $('#table1 tr').has('input[type="checkbox"]:checked').hide() }) for &lt;table class="table2" id="table1"&gt;&lt;input type = 'button' name = 'hide1' id='hide1' value = 'löschen' /&gt; 如果是这样,我得到一个“TypeError: jQuery is undefined”跨度>
  • 好的,对不起,我对此很陌生。不幸的是,为此我收到了“TypeError:jQuery 未定义”。有什么想法吗?
  • 页面中是否包含 jQuery?你在页面中使用 noConflict() 吗?
  • 页面包含jQuery之后是否放置脚本
  • 是的,包含 jquery。你的意思是这样的:var $ha = jQuery.noConflict(true); $ha('#hide1').click( function(){ $('#table1 tr').has('input[type="checkbox"]:checked').hide() })
猜你喜欢
  • 1970-01-01
  • 2010-11-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-01-03
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多