-6

選択に従って、テキスト フィールドの値を変更します

$(document).ready(function(){
    $("#combo1 option:selected").change(function() {    
        if (this.value == "Egreso"){
            $("#monto").val("-");
        }
    })
});
4

1 に答える 1

4

change イベントは、要素内の要素でselectはなく、要素自体で発生しoptionます。これを試して:

$(document).ready(function(){
    $("#combo1").change(function() {   
        if ($(this).val() == 'Egreso') {
            $("#monto").val("-");
        }
    })
});
于 2013-06-28T14:07:36.417 に答える