How to display value in a td with a particular class name, by clicking in another td using jquery?
<p>I have to display contents in the cells of a table.</p>

<p>The table is as follow:</p>

<pre><code>&lt;table id="innertable"&gt;
                        &lt;thead&gt;
                            &lt;tr class="tablewrapperheader"&gt;
                                &lt;th&gt;Status&lt;/th&gt;
                                &lt;th&gt;Date Requested&lt;/th&gt;
                                &lt;th&gt;Date Time Range&lt;/th&gt;
                                &lt;th&gt;Reason&lt;/th&gt;
                                &lt;th&gt;Date Approved/Denied&lt;/th&gt;
                                &lt;th&gt;Reason Denied&lt;/th&gt;
                                &lt;th&gt;Approve/Deny&lt;/th&gt;
                            &lt;/tr&gt;
                        &lt;/thead&gt;
                        &lt;tbody&gt;
                            &lt;tr class="odd"&gt;
                                &lt;td id="check" class="pending"&gt;&lt;img src="../images/icons/36x36/exclamation.gif" alt="exclamation"/&gt;
                                    &amp;nbsp;&lt;span id="checkMsg"&gt;Pending&lt;/span&gt;&lt;/td&gt;
                                &lt;td&gt;06/15/2012&lt;/td&gt;
                                &lt;td&gt;06/21/2012&lt;/td&gt;
                                &lt;td&gt;Medical Checkups&lt;/td&gt;
                                &lt;td class="dateApproveDenied"&gt;&lt;/td&gt;
                                &lt;td class="reasonDenied"&gt;&lt;/td&gt;
                                &lt;td&gt;&lt;img src="../images/icons/128x128/approve.png" class="actionApprove" alt="exclamation" height="16" width="16"/&gt;&amp;nbsp;&amp;nbsp;&lt;img src="../images/icons/128x128/deny.png" class="actionDeny" alt="" height="16" width="16"/&gt;&lt;/td&gt;
                            &lt;/tr&gt;
</code></pre>

<p>User will click on active or deny and if the deny they have to give reason for denial. I have to display the date of denial and reason in the respected td for which i am using class names "dateApproveDenied" and "reasonDenied". I am using Jquery to achieve this affect but to no avail. </p>

<p>Here is my jquery</p>

<pre><code>$(".actionDeny").click(function(){

    var reason = prompt("Write reason for denial.",'');
    var today = new Date();
    var dd = today.getDate();
    var mm = today.getMonth()+1; //js months 0-11
    var yyyy = today.getFullYear();
    if(dd&lt;10){
        dd='0'+dd
    }
    if(mm&lt;10){
        mm='0'+mm
    }
    var today = mm+'/'+dd+'/'+yyyy;
    $(this).closest('td .dateApproveDenied').text(today);
    $(this).closest('td .reasonDenied').text(reason);
});
</code></pre>

<p>I get the prompt for writing the reason but reason and dates are not appearing in the td. Can please somebody help me to set it right. Thanks</p>
