Created
August 24, 2016 16:26
-
-
Save pcote/917bf72fcbbd4ebb0185c36823e3f1a6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>jQuery Loop Concat</title> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script> | |
</head> | |
<body> | |
<ul id="targetlist"> | |
</ul> | |
<script> | |
$(function(){ | |
var data = { | |
myinfo: "Some words to comes up with here".split(" ") | |
}; | |
data.myinfo.forEach(function(word){ | |
var listItemText = "<li>" + word + "</li>"; | |
var listItemDom = $(listItemText); | |
$("#targetlist").append(listItemDom); | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment