Jump to content

[SOLVED] Toggle Overriding Colspan.


seventheyejosh

Recommended Posts

Hello all! I have a simple js function that toggles a tr's style like so:

 

<tr style="display:none;" id="tr1">

    <td colspan="4">

 

my problem is that when i hit the js and toggle the display which does a

 

document.getElementById('tr1').style.display='block';

 

it makes the inner td lose all of its colspan properties.

 

 

basically if i take off the display:none, the whole page shows up fine.

 

but if i leave it on and use the button to toggle the display, the whole page borks, because the colspan is lost.

 

is there a way to fix this?

 

Thanks :)

 

 

Link to comment
Share on other sites

instead of block, use 'table-row':

document.getElementById('tr1').style.display='table-row';

 

if you didn't have the style on to start, you could do:

document.getElementById('tr1').style.display='none';
document.getElementById('tr1').style.display='';

setting it to empty will restore it to it's default...but you default it to none...so that won't work :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.