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
Post a Comment