Paul Leading Paul Leading - 1 year ago 112
jQuery Question

Open div in current clicked TD

<table id="tab">
<tr><td class="click" id="111">111</td> <td id="222" class="click">222</td></tr>
<tr><td class="click" id="333">333</td> <td id="444" class="click">444</td></tr>

<div id="hidden">

#tab tr td {
padding: 10px;
border: solid 1px red;

#hidden {
width: 40px;
height: 40px;
display: none;


How to open div #hidden in current clicked TD? and if i click outside #hidden i would like hide this div.


Answer Source

I'm not sure what you mean by "How to open div #hidden in current clicked TD", but to show and hide the #hidden div you could do like this:

<table id="tab">
    <td class="click" id="111">1</td> 
    <td class="click" id="222">2</td>
    <td class="click" id="333">3</td> 
    <td class="click" id="444">4</td>

<div id="hidden">text</div>

$(document).click(function() {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download