dimanche 6 novembre 2016

$('#' + somestring).anything not working?

Afternoon, the current website I'm coding dynamically gets articles from the server and inserts them into a scrolling table, but I'm having issues keeping track of them

function addArticle() {

var div = document.createElement("div");

 var id="div"+count.toString();
 div.id=id;

 $('#'+id).load("http://localhost:8080/dog/demo.html"+count.toString(),function()   {});


 document.getElementById("newsfeed_table").rows[0].appendChild(div);
 count++;
}

Now if I set all the div's id's to "div1" then the articles load, if I what I'm doing here, $('#'+id) it doesn't work, it doesn't throw errors either though, and the above is the problem, cause i've tested that string concatenation as a Jquery id on other things inn my page and it fails. ANY help appreciated.




Aucun commentaire:

Enregistrer un commentaire