Category : dom-events

I am trying to append a new li item along with the close element to my list in this to do list web-project.Why isn’t it working? Here is my js code: addbutton=document.getelementbyid("addbutton"); > addbutton.addeventlistener(‘onclick’, addtolist); function > addtolist(e){ const ultag=document.queryselector("#myUL"); > const myinputvalue=document.getelementbyid("myinput").value; > const newli=document.createelement("li"); newli.innerHTML=myinputvalue; > ultag.appendchild(newli); > const addedx=document.createelement("span"); addedx.innertext="x"; > added.classname="close"; ..

Read more

What I did ? adding event listeners to all divs of type = "button" when user clicks on any button I recorded the user clicks in an array using ‘this’ keyword CODE: var userClickedPattern = []; var totalNoOfButtons = document.querySelectorAll(“div[type=button]”).length; for (var i = 0; i < totalNoOfButtons; i++){ document.querySelectorAll(“div[type=button]”)[i].addEventListener(“click”, userClick); } function userClick(){ var ..

Read more

I have a small web page allowing me to make a voice recording, so generating an audio clip, and then save it locally. It works and the relevant JavaScript code is: var clipLink = document.createElement(‘a’); clipLink.href = audioURL; clipLink.download = ‘MyClip.wav’; clipLink.innerHTML = ‘Save locally’; container.appendChild(clipLink); Here comes my question. When the audio clip has ..

Read more