Coding style: Declare before used and add function comments

This commit is contained in:
Michal Čihař 2013-10-02 11:54:13 +02:00
parent 5671039ba2
commit 51bb5ffc31

View File

@ -14,6 +14,20 @@ function show_hide_clauses($thisDropdown)
}
}
/**
* Sets dropdown options to values
*/
function setDropdownValues($dropdown, values) {
$dropdown.empty();
var optionsAsString = '';
// add an empty string to the beginning for empty selection
values.unshift('');
$.each(values, function () {
optionsAsString += "<option value='" + this + "'>" + this + "</option>";
});
$dropdown.append($(optionsAsString));
}
/**
* Retrieves and populates dropdowns to the left based on the selected value
*
@ -89,17 +103,6 @@ function getDropdownValues($dropdown) {
});
}
function setDropdownValues($dropdown, values) {
$dropdown.empty();
var optionsAsString = '';
// add an empty string to the beginning for empty selection
values.unshift('');
$.each(values, function () {
optionsAsString += "<option value='" + this + "'>" + this + "</option>";
});
$dropdown.append($(optionsAsString));
}
/**
* Unbind all event handlers before tearing down a page
*/