My javascript programs Eventlistener not work? | Sololearn: Learn to code for FREE!

-1

My javascript programs Eventlistener not work?

hello dear helper my javascript project not work in sololearn apps... But the program work in my computer please help my project problem solf

5/6/2021 4:57:53 AM

jakaria sikder

2 Answers

New Answer

+2

jakaria sikder Make a code and share link here. We can't help like this. Btw write your js code inside this window.onload = function () { }

0

my javascript code : var title = document.querySelector("#subjectName"); var titleA = document.querySelector(".kar"); var btn = document.querySelector("#btn"); var pr = document.querySelector("#title_result"); btn.addEventListener('click', function(){ if(titleA.value == "" || title.value == ""){ alert("please feel the box"); }else if(titleA.value>=80 && titleA.value<=100){ var newR = document.createElement("tr"); var newh = document.createElement("th"); var newj = document.createElement("th"); var newi = document.createElement("th"); newh.innerHTML= title.value; newj.innerHTML= titleA.value; newi.innerHTML= "A+" ; newR.appendChild(newh); newR.appendChild(newj); newR.appendChild(newi); pr.appendChild(newR); }else if(titleA.value>=70 && titleA.value<80){ var newR = document.createElement("tr"); var new