i am having six buttons in a table,after clicking each button the data related to button should display,if i click another button previous data should disappear and only data with respect to that button should display.I am Using div. please help me how to do it.
You can hide div first then you can show that according to button Id. Please see Fiddle
$("#bt1").click(function(){
$(".hide").hide();
$("#id1").show();
})
$("#bt2").click(function(){
$(".hide").hide();
$("#id2").show();
})
$("#bt3").click(function(){
$(".hide").hide();
$("#id3").show();
})
.hide{display:none}
<table>
<tr>
<td><button type="button" id="bt1">button1</button></td>
<td><button type="button" id="bt2">button2</button></td>
<td><button type="button" id="bt3">button3</button></td>
</tr>
</table>
<div id="id1" class="hide">Button1</div>
<div id="id2" class="hide">Button2</div>
<div id="id3" class="hide">Button3</div>
https://jsfiddle.net/zgwugk5y/3/
</div>