Created
December 6, 2014 18:01
-
-
Save joelburton/3ec17ab73d4ee88f3c61 to your computer and use it in GitHub Desktop.
// source http://jsbin.com/fiqawupihi
This file contains 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> | |
<head> | |
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script> | |
</head> | |
<body> | |
Limit: <input id="num"> <button>Show</button> | |
<ul id="melons"> | |
</ul> | |
<script id="jsbin-javascript"> | |
var melons = ["Watermleon", "Musk Melon", "Canteloupe"]; | |
var ul = $("#melons"); | |
$("button").click(function () { | |
var limit = parseInt($("#num").val()); | |
for (var i = 0; i < limit && i < melons.length; i++) { | |
ul.append("<li>" + melons[i] + "</li>"); | |
} | |
}); | |
</script> | |
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html> | |
<html> | |
<head> | |
<script src="//code.jquery.com/jquery-2.1.1.min.js"><\/script> | |
</head> | |
<body> | |
Limit: <input id="num"> <button>Show</button> | |
<ul id="melons"> | |
</ul> | |
</body> | |
</html></script> | |
<script id="jsbin-source-javascript" type="text/javascript">var melons = ["Watermleon", "Musk Melon", "Canteloupe"]; | |
var ul = $("#melons"); | |
$("button").click(function () { | |
var limit = parseInt($("#num").val()); | |
for (var i = 0; i < limit && i < melons.length; i++) { | |
ul.append("<li>" + melons[i] + "</li>"); | |
} | |
});</script></body> | |
</html> |
This file contains 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
var melons = ["Watermleon", "Musk Melon", "Canteloupe"]; | |
var ul = $("#melons"); | |
$("button").click(function () { | |
var limit = parseInt($("#num").val()); | |
for (var i = 0; i < limit && i < melons.length; i++) { | |
ul.append("<li>" + melons[i] + "</li>"); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment