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
https://forums.phpfreaks.com/topic/166108-solved-toggle-overriding-colspan/
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 :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.