I have a bit of javascript that will dynamically add a static post to a loop. The script uses the jQuery 'after' method and on a static page it works beautifully but when inside the loop I don't get any results.
Can anyone see what i'm doing wrong here? Does WP not allow DOM insertion within a loop?
function newTile(){
var adTile = "<div class='new-box' id='article-tile'><h1> this is a test</h1> </div>";
var adLoc = 5;
var tiles = $('#article-tile:nth-child('+adLoc+')');
$(tiles).after(adTile);
}
tilescontains a DOM element?