Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67497

Is there another way to add an onclick function on an input button?

$
0
0

I tried onclick function on the intSubmit but for some reason when the code is executed the onclick is called once and when you press the button it does nothing. I tried using "debug()" but that, as I figured, doesn't work at all.

if(qType === "INTEGER"){
        let intAnswer = document.createElement("input");
        intAnswer.type = "text";
        intAnswer.id = "intA";
        let intSubmit = document.createElement("input");
        intSubmit.type = "button";
        intSubmit.onclick = debug();
        intSubmit.value = "Submit";
        qDiv.appendChild(intAnswer);
        qDiv.appendChild(intSubmit);
    }

Viewing all articles
Browse latest Browse all 67497

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>