Hello,

I need to add a new "customize" button next to the "Add to cart" button in the product page.
when I click first time on customize, the 'attributes' div is displayed, if I click second time on customize button, the attributes div is hidden.

To do this, I added this code on "Views/Product/_AddToCart.cshtml" :


<button class="customize-product" onclick="myFunction()">Customize</button>

        <script>
            function myFunction() {
                var x = document.getElementById("attributes");
                if (x.style.display === "none") {
                    x.style.display = "block";
                } else {
                    x.style.display = "none";
                }
            }
        </script>


The problem, when I click on the customize button, the attributes div is hidden for one second and then is displayed!

can someone help me please?

Thank you.