选择接下来的两行x类以在HTML表格中切换 [英] select next two rows of class x to toggle in HTML table
本文介绍了选择接下来的两行x类以在HTML表格中切换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我用HTML编写了一个表,并使用JQuery来解决它。我的表有三种类的行。当我点击某个类的一行,我想切换显示另一个类型的下两行。
我的Javascript / JQuery函数如下所示:
$(document).ready(
function(){
debugger;
$( #datagrid tr.level1)。addClass( odd);
$( .level2)。hide();
$( 。level3)。hide();
$( #datagrid tr.odd)。点击(
功能(){
$( this )。find( 。level3)。toggle(); // 这里我想找到接下来的两行等级3并切换它们
}
);
}
);
如何实现这一目标?
解决方案
(document).ready(
function(){
debugger;
( #datagrid tr.level1)。addClass( odd);
( 。level2 。跨度>)隐藏();
Hi,
I have written a table in HTML and using JQuery to play around with it.My table has got rows of three types of classes.When I click on a row of certain class,I want to toggle displaying next two rows of another type.
My Javascript/JQuery function looks like the following:
$(document).ready(
function () {
debugger;
$("#datagrid tr.level1").addClass("odd");
$(".level2").hide();
$(".level3").hide();
$("#datagrid tr.odd").click(
function () {
$(this).find(".level3").toggle();//here I want to find next two rows of class level3 and toggle them
}
);
}
);
How can I achieve this?
解决方案
(document).ready( function () { debugger;
("#datagrid tr.level1").addClass("odd");
(".level2").hide();
这篇关于选择接下来的两行x类以在HTML表格中切换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文