我无法隐藏这张桌子 [英] I can't hide this table
本文介绍了我无法隐藏这张桌子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个表格显示和隐藏的代码,但我想隐藏它,因为它是学生的答案
我尝试过的:
i have a code for table show and hide,but i want to hide it because it is as an answer for student
What I have tried:
<!DOCTYPE html>
<head>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script>
$(document).ready(function() {
//To hide the table
$(".hidetable").click(function () {
$(".table_bg").hide("fast")
});
//To show the table
$(".showtable").click(function () {
$(".table_bg").show(2000);
});
//To hide ODD rows
$(".hideoddrows").click(function () {
$(".table_bg tr:odd").hide("slow")
});
//To show ODD rows
$(".showoddrows").click(function () {
$(".table_bg tr:odd").show(1000)
});
});
</script>
<style>
.table_bg {
width:40%;
font-family:verdana;
font-size:15px;
color:#fff;
padding: 10px;
text-align:center;
}
.table_bg th{
background: #0780BA;
color: #fff;
line-height:35px;
}
.table_bg td{
background: #99DBFB;
padding:10px;
color: #000;
}
</style>
</head>
<body>
<h1>jQuery hide/show demo</h1>
<button class="hidetable">Hide Table</button>
<button class="showtable">Show Table</button>
</p>
<table class="table_bg">
<tr>
<th>Age</th>
<th>Salary</th>
</tr>
<tr>
<td>1</td>
<td>Jim</td>
</tr>
<tr>
<td>2</td>
<td>Anna</td>
</tr>
<tr>
</tr>
</table>
</body>
</html>
推荐答案
(document).ready(function(){
// To隐藏表
(document).ready(function() { //To hide the table
(。hidetable)。单击(function(){
(".hidetable").click(function () {
(。table_bg)。hide(fast )
});
//显示表格
(".table_bg").hide("fast") }); //To show the table
这篇关于我无法隐藏这张桌子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文