单击单选按钮显示隐藏表 [英] Show hide tables on click of radio button

查看:104
本文介绍了单击单选按钮显示隐藏表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个页面中有10-15个表,所有这些表都需要在点击单独的是/否单选按钮时显示。请告诉我怎么做



我尝试过的事情:



i已经使用了jquery,但是所有的工作只在一个表上我需要为所有表分开

I have 10-15 tables in a page and all those tables need to be displayed on click of separate yes/no radio buttons. plz tell me how to do it

What I have tried:

i have used jquery but all works on one table only i need separate for all tables

推荐答案

你必须找到当前单选按钮上的表格,如


You have to find the table over the current radio button like


(。radio_buttons)。click(function(){



//请将parent_class替换为父元素的类名,它是

// radio_button的父级,以及将控制点击的表格。
(".radio_buttons").click(function(){

// please replace the parent_class with the class name of the parent element, thet is
// parent for the radio_button and the table wich will be controled of clicking.


(this).parents(。parent_class)。finds(。table_class)。hide();



});





示例HTML



(this).parents(".parent_class").finds(".table_class").hide();

});


Example HTML



< input type =radioclass =radio_buttons/>






<input type="radio" class="radio_buttons" />








<div class="parent_class">
<input type="radio" class="radio_buttons" />
<table class="table_class">
</table>
</div>










<div class="parent_class">
<input type="radio" class="radio_buttons" />
<table class="table_class">
</table>
</div>


这篇关于单击单选按钮显示隐藏表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆