Created
May 13, 2015 08:08
-
-
Save arturcarvalho/2be93470e745a082d640 to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/bitavi
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> | |
<script src="http://jashkenas.github.io/underscore/underscore-min.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<textarea id="txt-pri" cols="100" rows="25">lorem ipsum lorem outrum linhum | |
</textarea> | |
<textarea id="txt-sec" cols="100" rows="25">blaem blaum xxxem xxxrum blahum | |
</textarea> | |
<p></p> | |
<input id = "btnSubmit" type="submit" value="Update"/> | |
<ul id='slicedList'> | |
</ul> | |
<div id='res1'></div> | |
<script id="jsbin-javascript"> | |
var update = function() { | |
var text1 = $('#txt-pri').val().trim(); | |
var text2 = $('#txt-sec').val().trim(); | |
var prim = text1.split(/\n/); | |
var sec = text2.split(/\n/); | |
var l = []; | |
_.each(prim, function(val, i){ | |
var o = {}; | |
o.primary = prim[i]; | |
o.secondary = sec[i]; | |
l.push(o); | |
}); | |
var res = JSON.stringify(l); | |
res = res.split("},{").join("},<br/>{"); // add the enters to look cleaner | |
$('#res1').html(res); | |
}; | |
$("#btnSubmit").click(function(){ | |
update(); | |
}); | |
</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> | |
<script src="//jashkenas.github.io/underscore/underscore-min.js"><\/script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<textarea id="txt-pri" cols="100" rows="25">lorem ipsum lorem outrum linhum | |
</textarea> | |
<textarea id="txt-sec" cols="100" rows="25">blaem blaum xxxem xxxrum blahum | |
</textarea> | |
<p></p> | |
<input id = "btnSubmit" type="submit" value="Update"/> | |
<ul id='slicedList'> | |
</ul> | |
<div id='res1'></div> | |
</body> | |
</html></script> | |
<script id="jsbin-source-javascript" type="text/javascript">var update = function() { | |
var text1 = $('#txt-pri').val().trim(); | |
var text2 = $('#txt-sec').val().trim(); | |
var prim = text1.split(/\n/); | |
var sec = text2.split(/\n/); | |
var l = []; | |
_.each(prim, function(val, i){ | |
var o = {}; | |
o.primary = prim[i]; | |
o.secondary = sec[i]; | |
l.push(o); | |
}); | |
var res = JSON.stringify(l); | |
res = res.split("},{").join("},<br/>{"); // add the enters to look cleaner | |
$('#res1').html(res); | |
}; | |
$("#btnSubmit").click(function(){ | |
update(); | |
});</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 update = function() { | |
var text1 = $('#txt-pri').val().trim(); | |
var text2 = $('#txt-sec').val().trim(); | |
var prim = text1.split(/\n/); | |
var sec = text2.split(/\n/); | |
var l = []; | |
_.each(prim, function(val, i){ | |
var o = {}; | |
o.primary = prim[i]; | |
o.secondary = sec[i]; | |
l.push(o); | |
}); | |
var res = JSON.stringify(l); | |
res = res.split("},{").join("},<br/>{"); // add the enters to look cleaner | |
$('#res1').html(res); | |
}; | |
$("#btnSubmit").click(function(){ | |
update(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment