DropDown list selected index change event how to w

2019-08-04 05:21发布

问题:

How written the jquery

DropDown list selected index change event how to work jquery?

回答1:

You can use below code:

<select id="selDiv" name="selDiv">
       <option>111</option>
       <option>222</option>
       <option>333</option>
    </select>

    $('#selDiv').change(function(){
       /// you can write you code what you want to do...
    });


回答2:

<select class="target">
    <option value="option1" selected="selected">Option 1</option>
    <option value="option2">Option 2</option>
  </select>

$(document).ready(function(){

$('.target').change(function() {
  alert('Dropdown Changed');
});

});

Further Reference



标签: c# jquery razor