1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-20 14:55:21 +03:00

delegate based input field bounds validator

This commit is contained in:
cTn 2014-01-15 20:25:51 +01:00
parent 2bb98ce31d
commit e2f10918a4

15
main.js
View file

@ -77,6 +77,21 @@ $(document).ready(function() {
}); });
tab_initialize_default(); tab_initialize_default();
// listen to all input change events and adjust the value withing limits if necessary
$("#content").on("change", 'input[type="number"]', function() {
var min = parseFloat($(this).prop('min'));
var max = parseFloat($(this).prop('max'));
var val = parseFloat($(this).val());
if ($(this).prop('min')) {
if (val < min) $(this).val(min);
}
if ($(this).prop('max')) {
if (val > max) $(this).val(max);
}
});
}); });
function notify(message, color) { function notify(message, color) {