What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-10-27 02:46:17
foreach function into arrow with addeventlistener
const toggleElements = document.querySelectorAll('.toggle'); toggleElements.forEach(el => { el.addEventListener('click', () => { this.classList.toggle('active'); // `this` refers to `window` // Error: Cannot read property 'toggle' of undef... Add solution -
TypeScript 2021-10-08 22:39:03
convert js to ts
var acc = document.getElementsByClassName("accordion"); var i; for (i = 0; i < acc.length; i++) { acc[i].addEventListener("click", function() { this.classList.toggle("active"); var panel = this.nextElementSiblin... Add solution -
Html 2021-10-03 21:51:02
how to add see button in password input in html
togglePassword.addEventListener('click', function (e) { // toggle the type attribute const type = password.getAttribute('type') === 'password' ? 'text' : 'password'; password.setAttribute('type', type); // toggle the eye / eye slash icon ... Add solution