I want to know how to avoid sending a form. What I need is that if the sum of number2 with number3 is equal to number1 the form is sent but if it is different that the sending of the form stops avoiding the values in the input tags are deleted. Thanks.
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0"/>
<title></title>
</head>
<body>
<form>
<input type="number" id="numero1" required>
<input type="number" id="numero2" required>
<input type="number" id="numero3" required>
<button type="submit" >Guardar</button>
</form>
<script>
function evitar_envio_formulario() {
if (numero1 == numero2 + numero3) {
//Se envia el formulario
}else {
//No se envia el formulario
}
}
</script>
</body>