I am creating a form, and I have a situation of a field that has to be filled depending on the multiplication of some if it is bigger than it has to fill the field if it is smaller that you do not have to fill it.
I am doing this with javascript but I am new and I do not know if the code is correct because IF
this is my code: javascript
Javascript Code:
<script>
function continuar(){
var Num = document.getElementById("multiprica").value;
var Acc = document.getElementById("Plan_Accion").value;
if(Num > 4){
if (Acc.length==""){
var errorNombre=document.createElement('p');
errorNombre.innerHTML= 'No escribiste tu nombre';
document.getElementById("Comentarios").appendChild(errorNombre);
return false;
}
}
}
</script>
This is my field that needs to be filled
HTML Code:
<div class="col-xs-17">
<label for="sel1">Plan de Acción: es un plan que prioriza las iniciativas más importantes para cumplir con ciertos objetivos y metas</label>
<input hidden="¿QUE?" name="ID_QUE" value="1">
<textarea class="form-control" rows="3" name="Plan_Accion" value="Plan_Accion"></textarea>
</div>
this is the button that calls the javascript function HTML code:
<div class="btn-group btn-group-lg">
<button type="submit" class="btn btn-primary" onclick="return continuar();">Continuar</button> </div>