Ciao a tutti,
usando wordpress che in un modulo mi duplica gli id mi trovo a dover modificare con una funzione 2 parti con id uguali. Esempio:
in questo caso solo il primo id diventa red invece a me servirebbe che entrambi diventassero red. Come posso fare? Graziecodice HTML:<p id="demo">Click the button to change the color of this paragraph.</p> <p id="demo">Click the button to change the color of this paragraph.</p> <button onclick="myFunction()">Try it</button> <script>function myFunction() { var x = document.getElementById("demo"); x.style.color = "red";}</script>

Rispondi quotando