2017-04-06 11 views
0

に動作していないラジオボタンの値を設定した後、これはDBからその変更イベントが

$('input[name=EditDepositType]').val(DepositType).prop('checked','true'); 

その変更イベントを、その値を設定するラジオボタン

    <div class="col-md-6"> 

         <div class="form-group"> 

          <label class="radio-inline"><input type="radio" value="0" name="EditDepositType">نقد</label> 

          <label class="radio-inline"><input type="radio" value="1" name="EditDepositType">چیک</label> 

         </div> 

        </div> 



       </div> 

のコードがあります

$('input[type=radio][name=EditDepositType]').change(function() { 
    if (this.value === '1') { 
     $('.chequeData5').show(); 
     $('.chequeData3').show(); 
     $('.chequeData4').show(); 
    } 
    else{ 
     $('.chequeData5').hide(); 
     $('.chequeData3').hide(); 
     $('.chequeData4').hide(); 
    } 

}); 

私はラジオをチェックするときボタンをinspect要素で設定した後、両方のラジオボタンの値が同じCheck Image

答えて

0

checkedの状態がプログラムによって変更された場合、イベントはトリガされません。手動で.trigger('change')する必要があります。

$('input[name=EditDepositType]').val(DepositType) 
    .prop('checked',true) 
    .trigger('change'); 
+0

何も起こらない –

関連する問題