Skip to content

Instantly share code, notes, and snippets.

@lyonsun
Created June 25, 2014 03:01
Show Gist options
  • Save lyonsun/2f7f9de58f5ac975e22e to your computer and use it in GitHub Desktop.
Save lyonsun/2f7f9de58f5ac975e22e to your computer and use it in GitHub Desktop.
dummy js script to create a select dropdown list in a new window
$('#preview').bind('click', function(e) {
var minimum = parseInt($('#minimum').val());
var maximum = parseInt($('#maximum').val());
var interval = parseInt($('#interval').val());
var times = Math.floor(maximum/interval);
var html = '';
for (var i = 0; i < times; i++) {
html += "<option value='" + minimum.toFixed(2) + "'>" + minimum.toFixed(2) + "</option>";
minimum += interval;
if (minimum > maximum) {
break;
};
};
var w = window.open();
var html = "<select>" + html + "</select>";
$(w.document.body).html(html);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment