Home  >  Q&A  >  body text

javascript - avalon.js ms-on event binding is invalid?

select binding event

   <select class="form-control box-shadow-none select-device-type" name="macAddress" ms-on-change="selectChange()">
                    <option  value="11">111</option>
                </select>
                
                
                 var vm = avalon.define({
        $id: "checkDeviceContext",
        deviceList: [],
        selectChange: function () {
            alert(1)
        }
    });

If you change change to click, there will be no problem. What is the reason?

typechotypecho2685 days ago914

reply all(1)I'll reply

  • phpcn_u1582

    phpcn_u15822017-07-05 10:44:46

    Because the triggering conditions of ms-on-change are similar to the onchange triggering conditions of select, both are triggered when the value changes.

    In your example, there is only one option under select, so even if you click, it will not change the value of select, so ms-on-change will not be triggered.

    reply
    0
  • Cancelreply