خرید بک لینک

Vote count: 0

I am leaing Jquery. I am trying to to understand the selected options. So when user select a option I can do something.

I trying to run Jquery so that when the user selects customAmountSelected that it should add a class 'xxx' to customAmountinput

$( document ).ready(function() {
        

        
        if ($("#amountSelected:selected").val() == 'customAmountSelected' ) {
                
                
                $('.customAmountinput').addClass('xxx');
        }
        
        
});
.displaynone {display: none;}
<div>
<div class="form-group">
                                                                                                                                <label>Budget (&pound;)</label>
                                                                                                                                <select class="form-control" id="amountSelected">
                                                                                                                                        <option selected="selected">No budget</option>
                                                                                                                                        <option value="5">£5</option>
                                                                                                                                        <option value="30">£10</option>
                                                                                                                                        <option value="20">£20</option>
                                                                                                                                        <option value="50">£50</option>
                                                                                                                                        <option value="100">£100</option>
                                                                                                                                        <option value="customAmountSelected">Custom</option>
                                                                                                                                </select>
                                                                                                                                <p class="small"><em>Need some text here to explain why they can edit budget </em></p>
                                                                                                                        </div>
                                                                                                                        <!-- appear when user selected custom budget -->
                                                                                                                        <div class="form-group displaynone customAmountinput">
                                                                                                                                <label>Enter ammount</label>
                                                                                                                                <input class="form-control" placeholder="&pound;">
                                                                                                                        </div>
                                                                                                                        <div class="form-group">
                                                                                                                                <div class="checkbox">
                                                                                                                                        <label>
                                                                                                                                                <input type="checkbox" value checked> Post to wall?
                                                                                                                                        </label>
                                                                                                                                </div>                                                                                                                            
                                                                                                                        </div>
  </div>
asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 24 فروردين 1395 ساعت: 22:01

صفحه بندی