Imam Imam - 2 months ago 6x
Javascript Question

Javascript change value when choose on select box

<div class="main">
<div class="harga">Rp.2,680,000 / Bln</div>
<div class="other">Kontrak Setahun
atau <label>Rp. 2,930,000 / Bln</label></div>
<div class="traffic">Pilih traffic Anda dibawah ini</div>
<select class="visitor">
<option value="5,000">Up To 5,000</option>
<option value="7,900">Up To 7,900</option>
<option value="17,600">Up To 17,600</option>
<option value="25,000">Up To 25,000</option>
Visitor / Bulan

<script type="text/javascript">
$(function() {
if((".visitor").val() == "5,000") {
$(".harga").value == "4000";

i have this script, how can I change the value on harga from visitor, when I choose selection from select box?

thank you before.


Use change event like this

        if($(this).val()  == '5,000'){
                // write your to do action here