Skip to content

Instantly share code, notes, and snippets.

@jremi
Last active November 22, 2021 01:19
Show Gist options
  • Save jremi/73876ece01808c0c852b9e4afa6a7547 to your computer and use it in GitHub Desktop.
Save jremi/73876ece01808c0c852b9e4afa6a7547 to your computer and use it in GitHub Desktop.
For loop to display emoji icon
var imgSource = 'http://fonts.voxmedia.com/emoji/unicode/1f4a9.png';
var txtSource = "shit ♥ ";
var valueInput = prompt("How many shit faces?");
for (var a = 1; a <= valueInput; a++) {
$("#container").add("div").attr('id', "image" + a);
$("#image" + a).append("<img class = 'emojiIcon' src=" + imgSource + ">");
$("#container").add("div").attr('id', "text" + a);
$("#text" + a).append("<h3 class = 'emojiNumber'>" + txtSource + a + "</h3>");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment