I am trying to dynamically change the colspan attribute on a group of
cells using the code below:
<script type="text/javascript">
$(document).ready(function() {
     $('#plusSign').click(function(){
        $('.ba_toggle').toggle();
        if($('#plusSign').attr('src')=='../Images/
1button_increase_colspan.gif')
             {
                
$('#plusSign').attr('src','../Images/1button_decrease_colspan.gif');
                $('td.ba_colspan').attr('colspan',2);
             }
        else
            {
                
$('#plusSign').attr('src','../Images/1button_increase_colspan.gif');
                $('td.ba_colspan').attr('colspan',4);
            }
     });
});
</script>

I added a bunch of alert tags to show me whether the attribute was
being changed and it shows them as changed but the page renders
incorrectly. The table on the screen does not change the colspan
rendering. The $('.ba_toggle').toggle()) hides and shows the extra two
columns correctly but the colspan does not adjust at all.

What am I doing wrong?

Reply via email to