jQuery, Tables, & Show / Hide

jQuery, Tables, & Show / Hide

So maybe I’m just an idiot and this would be obvious to others, but it completely confused me for a large portion of the night, so I thought I’d share in hopes of helping some other unfortunate soul.

The Problem

I was using a jQuery function to show / hide elements, first on a table row, then when that didn’t work, a table column. The problem is that jQuery’s show method sets an element’s display attribute to “block,” completely ignoring that it should instead be “table-column.” This causes some issues to say the least.

The Solution

Well this is where you’ve got some options… what I ended up doing was just creating a div element within the td and running the show / hide on that instead. You could as an alternative to this, create a custom show method that would simply set the display type correctly to table cell, column, or whatever.


Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Search

Categories

Lifestream