Looking for some help here. Sorry for bothering you all!

Hi All,

First time posting and I’m having a major problem with this website, and don’t know a way to fix it.
Here it is…
Right now I need a table to remove a column based on either Button1 is clicked or Button 2.

Unfortunately that table is loaded on a seperate .jsp file. From the 2 buttons that are on another jsp.
And I don’t know how to link them…

I’m trying to set it, so when you press Button1 it will hide the ‘test’ column.
And then when you press Button2 it will show the ‘test’ column

Also note that the table I’m referring to is nested inside of refreshGrids, from there it links to the 2nd JSP.

1st JSP

The HTML

 <button type="button" onclick="toggle2();"><h1>Button1</h1></button>
           <button type="button" onclick="toggle();"><h1>Button2</h1></button>
<div id="overlay" class="window">
<div class="messageContainer">
<div id="refreshGrid">
</div>
</div>

The CSS

#test{display:none;}

The Javascript

 <script type="text/javascript">
					function toggle(){
					$(this).parents("test").show();
					};
				</script>
 <script type="text/javascript">
					function toggle2(){
					$(this).parents("test").hide();
					};
				</script>

2nd JSP


<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ page contentType="text/html; charset=UTF-8" %>
<html>
   <body>
      <table class="bordered">
         <col width="75" />
         <col width="105" />
         <col width="70" />
         <col />
         <thead>
            <tr>
               <th>User</th>
               <th>Date Grid</th>
               <th>Grid</th>
               <th>Text</th>
            </tr>
         </thead>
         <tbody id="GridBody">
            <s:iterator value="%{gridBeans}" status="stat">
                  <td>
                     <s:property value="userName" />
                  </td>
                  <td>
                     <s:property value="gridTime" />
                  </td>
                  <td id="test">
                     <s:property value="numgrid" />
                  </td>
                  <td>
                     <s:property value="gridText" />
                  </td>
               </tr>
            </s:iterator>
         </tbody>
      </table>
      </div>
      </div>
      </div>
   </body>
</html>

Any help here please

The correct nesting of the divs according to Firebug is this…
<div id=“overlay” class=“window”>
<div class=“messagecontainer”>
<div id=“refreshGrid”>
<table class=“bordered”>
<tbody id=“GridBody”>
<tr>
<td></td>
<td id=“test”</td>
<td></td>
</tr>

Here’s a working solution for you, using the headers attribute. http://jsfiddle.net/KtnkF/1/

If you would rather not use the headers attribute in the table, it can also be done with a bit of additional scripting effort, as in http://jsfiddle.net/KtnkF/2/

This is great! However the buttons are on a seperate .jsp
How can I get them to communicate with the table that is on a different one…?
For example
1.jsp has the buttons
and 2.jsp has table…

woops! Ignore that…
I believe I have gotten it to work. Will post back shortly :slight_smile: