Skip to content

Tag: html

useState and useHooks in HTML

first of all, I can not use the “create-react-app” command in the current project. so here I am trying to add my react code into a plain HTML file. Here are my codes for HTML and js files. can anyone tell me why my hooks and setState don’t work properly? Please guide me to solve it. my like_…

How to replace text with a random array element?

I am trying to replace text with a random element in my array. When the user clicks on the text itself, the word should change to one of the elements in my array. I am having trouble with the function that lets me do so. I have text and wrapped span tags (named “hare”) around words that I want to

how to change with javascript

I have a Javascript function that I been dealing with for a few hours, Javascript: HTML: CSS: The <li> tag is meant to act as a button, and it does everything in the function, (changes .svg Icon and plays the music) but the second time I click it again, nothing happens. I also checked the console, and n…

Why I can not call method of WebComponent?

I wonder why I cannot call a method defined in web-component if I attached this component via .append instead of using tag name inside the template. Below I am providing few examples. One is not working(throwing an error). I wonder why this first example is throwing this error. Example 1 In this example, I am…

Cannot access element after creating it with append child

I am trying to create a chess game using html and js. Here is part of my HTML code: Here is the JS Everything works fine but the problem is when I use append child to copy image , I can no longer select the copied image. I can still select original one. Answer The problem is that you are