How to change text of button onclick?
Hello everyone, I want to change the text of a button when he is clicked. When he has prefix [+] change it to [-] else [+]. So I did this not-working attempt: <button id="operators_c" class="collapsible" onclick="col(this.id)">[+]Operators</button> <script> function Col(i) { var o = Document.getElementById(i); var sub1 = o.textContent.substring(0,4); if (sub1 == "[+]") { o.textContent = "[-]" & o.textContent; } if (sub1 == "[-]") { o.textContent = "[+]" & o.textContent; } } </script>