Find out if html form has changed

前端 未结 6 2164
清酒与你
清酒与你 2020-12-08 11:53

Using jquery I\'ve added a change handler to a form. This works when any input is changed BUT only if the user manually changes an input and not when some other code changes

6条回答
  •  既然无缘
    2020-12-08 12:11

    Not in a regular way.

    You can change with input and then trigger the change event.

    $('#inputId').val('foo').trigger('change');
    

    or with this:

    $('#inputId').val('foo').change();
    

提交回复
热议问题