<script type="text/css">
$(document).ready(function() {
$('#mydiv').hide();
$('.btn-group button').click(function(){
var target = "#" + $(this).data("target");
$("#mydiv").not(target).hide();
$(target).show();
});
});
</script>
<div class="btn-group">
<tr>
<td>
<button><?php echo $request;?>
</button>
</td>
<td>
<div id="mydiv">
<?php echo $Time;?>
</div>
</td>
<td>
<span class="glyphicon glyphicon-lock">
</span>
</td>
<td>
<?php echo $comments; ?>
</td>
</tr>
<div>here
答案 0 :(得分:0)
<script type="text/css">
$(document).ready(function() {
$('#mydiv').hide();
$('.btn-group button').click(function(){
var target = "#" + $(this).attr("data-target");
$("#mydiv").not(target).hide();
$(target).show();
});
});
</script>
<div class="btn-group">
<tr>
<td>
<button data-target="mydiv"> BTN <?php echo $request;?>
</button>
</td>
<td>
<div id="mydiv">
<p>CONTENT OF MYDIV</p>
<?php echo $Time;?>
</div>
</td>
<td>
<span class="glyphicon glyphicon-lock">
</span>
</td>
<td>
<?php echo $comments; ?>
</td>
</tr>
<div>here
这是一个工作小提琴:https://jsfiddle.net/ddan/8wzjod0j/