html - JavaScript: Defined Function Undefined -


so have js:

 document.getelementbyid("config2").addeventlistener("click", function(){    config3();    console.log("in function config.onclick()...");  });   function config3()  {    document.body.innerhtml+="<div style=\"opacity:0;\" class=\"popoutcont\" id=\"formcont\"><div style=\"opacity:0;\"><div class=\"popoutform\"></div></div>";    setinterval(function(){document.getelementbyid("formcont").style.opacity+=0.01;if(document.getelementbyid("formcont").style.opacity===1){clearinterval(this)}}, 1);    console.log("in function config...");  } 

and html:

<p class='spectxt' style='font-weight:normal;' id='config2'><strong>payload configuration:</strong> seats: 2</p>" 

first of all, event never occurs. no output sent console. second, chrome devtools js console says config3 undefined when call function. why happening , causing it?

run startup code on

<body onload="">  

since html content not loaded yet


Comments

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -