Skip to content

Instantly share code, notes, and snippets.

@nix1947
Created July 31, 2017 11:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nix1947/6c2c54f81ff42042655b5aba679bd792 to your computer and use it in GitHub Desktop.
Save nix1947/6c2c54f81ff42042655b5aba679bd792 to your computer and use it in GitHub Desktop.
jquery multiple elements appending
// create thumbnail tag
var li = $("<li></li>");
var h3 = $("<h3></h3>");
var p = $("<p></p>", {
text: itemTitle
});
var a = $("<a></a>",{
href: itemURL,
});
var img = $('<img />', {
src: itemThumbnail,
alt: itemTitle,
width: 200,
height: 120,
class: "img-responsive"
});
li.append(h3.append(a.append(img)));
li.append(p);
// create html template
$("#audioVideoSection").append(li);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment