• Resolved Imageihaspowermall

    (@ihaspowermall)


    Setting: internal, footer, infront
    My Footer JS code chrome inspect:
    <!– start Simple Custom CSS and JS –>
    <script type=”text/javascript”>
    document.querySelector(‘.total-weight th’).colSpan = 4;
    document.querySelector(‘.tax-total th’).colSpan = 4;
    </script>
    <!– end Simple Custom CSS and JS –>

    every time i reload my checkout page this code did work for a second, but it will come back to normal after checkout page reloaded.

    Is there any problem with it, as i see it did work from the first place.

Viewing 1 replies (of 1 total)
  • Plugin Author ImageSilkyPress

    (@diana_burduja)

    The code is alright. The only issue is that you want it to change something to the DOM, but at the moment of the execution the DOM isn’t loaded yet. See this article.

    Try this code instead:

    <!– start Simple Custom CSS and JS –>
    <script type="text/javascript">
    document.addEventListener('DOMContentLoaded', ()=>{
        document.querySelector('.total-weight th').colSpan = 4;
        document.querySelector('.tax-total th').colSpan = 4;
    });
    </script>
    <!– end Simple Custom CSS and JS –>
Viewing 1 replies (of 1 total)

The topic ‘The JS code adding colspan load and unload itself woocommerce checkout page’ is closed to new replies.