I find the following methods somewhat monotonous when adding a new video. Basically, I am targeting every nth child element added.
$(document).ready(function(){
$("li:nth-child(5) img").appendTo("li:nth-child(5) .video-gradient");
$("li:nth-child(6) img").appendTo("li:nth-child(6) .video-gradient");
$("li:nth-child(7) img").appendTo("li:nth-child(7) .video-gradient");
$("li:nth-child(8) img").appendTo("li:nth-child(8) .video-gradient");
$("li:nth-child(9) img").appendTo("li:nth-child(9) .video-gradient");
}
is there a better way to implement the code (allows ay in a for loop) that will prevent me from adding an nth-child element to the added video element?
Thanks a lot Robbie
source
share