Reputation: 69
Okay so what I'm trying to do is the following: if the input called 'autoPack'
is empty, show the div
'forma_reservas_gustos'
. If it is not empty, do NOT show the div
. The problem I'm having is that no matter what the value from the input
is, the div
is always displayed. I've tried so many things but nothing seems to be working.
HTML:
<input type="hidden" name="autoPack" id="autoPack" ng-model="autoPack" value="">
<div class="forma_reservas_gustos" ng-show="!autoPack">
<div class="forma_reservas_gustos_interior wid1k pbot20">
<div class="paso">
<div class="butpasos">
<img src="/wp-content/uploads/2017/08/uno.png" />
</div>
<div class="textpasos">
<h3>SELECCIONA EL PACK DE EXPERIENCIAS QUE MÁS TE GUSTE</h3>
</div>
</div>
[...]
JS
document.forms["forma_reservas_form"].autoPack.value = "xxxx";
When I inspect it with Google Developer Tools, the html input
does have the value 'xxxx'
. So it is in fact not empty, therefore the div
should not be displayed yet it is for some strange reason. Can anybody help me?
Upvotes: 1
Views: 65
Reputation: 22158
Looks like autoPack
needs to be a property of $scope
...not just a property on the form.
...
$scope.autoPack = "xxxx";
...
Upvotes: 1