I'm trying to populate a value dynamically with jquery:
In case I want to put the value of the plan value when selected with jquery.
Ex:
<div class="input-group input-group-lg">
<span class="input-group-addon">R$</span>
<input id="valor" type="number" min="0" class="form-control payment-value" aria-label="Amount (to the nearest dollar)" placeholder="Valor do pagamento">
</div>
<div class="input-group input-group-lg">
<select class="form-control plan">
<option value="39256">Plano R$ 10,00</option>
<option value="45659">Plano R$ 11,00</option>
</select>
</div>
In my JS I have:
this.PLAN_ID = $('.plan').val();
and a var data:
'plan': parent.PLAN_ID,
The problem is that when I change the 'plane', the value is not dynamically changed, ie the plane gets 39256 which is the default item, could anyone give a help?
Thank you