Created
May 2, 2014 09:27
-
-
Save ESeufert/2a18200dd2eb615cb522 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
function buildConsole(data) { | |
var html = ""; | |
html += "<div id=\"country-selector\" class=\"console-element\">"; | |
for (var i = 0; i < data.length; i++) { | |
html += "<div style=\"width: 150px; float: left;\">"; | |
html += "<input name=\"countries\" id=\"country-selector-" + data[i][0] + "\" type=\"checkbox\" "; | |
if (i == 0) { | |
html += "checked"; // set the first country to checked to provide some default data for the graphs | |
} | |
html += " value=\"" + data[i][0] + "\" /> "; | |
html += data[i][0]; | |
html += "</div>"; | |
} | |
html += "</div>"; | |
$('#console').html(html); | |
} | |
function getCountries() { | |
var elements = $("input:checkbox[name=countries]:checked"); | |
var countries = []; | |
$.each(elements, function () { | |
countries.push($(this).val()); | |
}); | |
return countries; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment