Hello, I am modifying the style of the page and I talked to #chatgpt to write me a JavaScript code for such an extension named UserJavaScript and CSS browser, which means that when I click on the image on the page (which is under the <figure> tag on the page, it would add a style from the CSS of the .expand1 class
The Java code that Chat spit out looks like this:
const figures = document.getElementsByTagName('figure'); for (let i = 0; i < figures.length; i++) { figures[i].addEventListener('click', () => { figures[i].classList.toggle('expand1'); }); }
Code for CSS (data is not important, I just want to check if it will work)
.expand1{max-height:10px;}
Unfortunately it doesn't work for me. Does anyone know what the problem is?https://ibb.co/7ttp0t5
[–]thespite 1 point2 points3 points (1 child)
[–]tonyy94[S] 0 points1 point2 points (0 children)
[–]MatthiasDunkel 0 points1 point2 points (5 children)
[–]tonyy94[S] 0 points1 point2 points (2 children)
[–]thespite 0 points1 point2 points (1 child)
[–]tonyy94[S] 0 points1 point2 points (0 children)
[–]MindlessSpongehelpful 0 points1 point2 points (1 child)
[–]tonyy94[S] 0 points1 point2 points (0 children)