dimanche 19 octobre 2014

Js: elem.onclick works, elem2.onclick doesnt fire at all


Vote count:

0




I'm stumped. I'm building a webapp for reading comics. Testing on Android 4.4.2 and Android L Dev preview (second edition, released this week)


The following code works:



var comicstack = document.createElement("div");
comicstack.className = "comicstack";
comicstack.comic = comic;
comicstack.onclick = function() {
loggr.log(" > Click: "+ this.comic);
site.hcomic.init(this.comic);
}


But when I hide the section that holds these elements and draw new ones in another section (done by site.hcomic.init), the onclick just doesn't fire



var comicstack = document.createElement("div");
comicstack.className = "comicstack";
comicstack.comic = series;
comicstack.issue = issue;
comicstack.onclick = function() {
loggr.log("HEY I'M BEING CLICKED BUT I'M IGNORING IT HAHA!");
}


What is the world am I doing wrong?


(Btw, the loggr.log() function is a wrapper around console.log, long story)



asked 29 secs ago

REJH

173






Js: elem.onclick works, elem2.onclick doesnt fire at all

Aucun commentaire:

Enregistrer un commentaire