javascript - Can't append a link element to an iframe with jQuery -
i'm building web app make business more automated html/css/jquery in front end , python in backend .
i wrote easy script jquery call route ajax , recieve data json , after parse , return list of iframes depending on it's length : if have 20 items in list , want 5 items per page, create 4 pages , put 5 iframes in each link .
here's code responsible feature :
$('.pagecontent').empty() (var = 0; < vidpagelist.length; i++){ var videourl = vidpagelist[i].videolink var posturl = vidpagelist[i].postlink console.log(posturl) $('<iframe src ="'+videourl+'" class = "videoentry" width = "360" height = "250"></iframe>').appendto( ".pagecontent" ) $('<a class = "postlink" href = "'+posturl+'"> video link </a>').appendto(".videoentry") }
the problem:
iframes added links not added @ all, don't know why, console not showing me error, tried debug values of posturl
, correct, why doing ? looks last line responsible adding link not working, tried add 1 appendto()
call added iframes, i'm missing here ?
the first time selectors ran, there no .videoentry class because in iframe. may useful first make html content before appending.
Comments
Post a Comment