This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
FunctionProject/scripts/execute-function/randomNumber_DOM.js

20 lines
802 B
JavaScript
Raw Normal View History

import { randomNumber } from '../functions/fonctions_principales/randomNumber_Function.js';
$(function () {
$("#randomNumberForm").submit((event) => {
event.preventDefault();
const minEntered = $('#minValue').val();
const maxEntered = $('#maxValue').val();
if(isEmptyValue(minEntered) || isEmptyValue(maxEntered)) {
$('.results').html(emptyMessageError);
}
else {
const result = randomNumber(minEntered, maxEntered);
if(result === messageError) {
$('.results').html(messageError);
} else {
$('.results').html("Nombre aléatoire compris entre " + minEntered + " inclus et " + maxEntered + " inclus : " + formatNumberResult(result));
}
}
});
});