Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery to hide table cell contents
    primarykey
    data
    text
    <p>I have a table that is laid out like this:</p> <pre><code>&lt;table&gt; &lt;tr&gt; &lt;td&gt;checkbox&lt;/td&gt; &lt;td&gt;text-text-text&lt;/td&gt; &lt;td&gt;dropdownlist&lt;/td&gt; &lt;td&gt;textbox&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>I'm trying to toggle visiblity of the dropdown list and textbox based on the check status of the checkbox. I've got a click event set up that does this correctly, but it does not persist the visibilty of the rows when new data is loaded. How can I do this in Jquery?</p> <p>Edit: This is the function that's hooked up to the click event on the checkbox. It toggles visibility of the elemtns correctly. The problem I'm having is getting new rows loaded from the database to start out with the correct visibility. (I'm using a repeater control in asp.net to build the table, so I'm passing in the client IDs into the function).</p> <p>Simplified: I have a table with a checkbox in the first cell of each row, what selector in jquery would i use to get at the contents of the rest of the cells in that row, from the checkbox.</p> <pre><code> function ToggleVisibility(position, hometown, state, checkbox, name, license) { if ($("#" + checkbox)[0].checked) { $("#" + position).css('visibility', 'visible').fadeIn('slow'); $("#" + hometown).css('visibility', 'visible').fadeIn('slow'); $("#" + state).css('visibility', 'visible').fadeIn('slow'); $("#" + name).css('font-weight', 'bold'); $("#" + license).css('font-weight', 'bold'); } else { $("#" + position).css('visibility', 'hidden').fadeOut('slow'); $("#" + hometown).css('visibility', 'hidden').fadeOut('slow'); $("#" + state).css('visibility', 'hidden').fadeOut('slow'); $("#" + name).css('font-weight', 'normal'); $("#" + license).css('font-weight', 'normal'); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload