Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在表单上有一个输入框,我想在该输入的值更改时触发一个事件。该值通常通过其他一些 jQuery 函数更改,并且在.change()发生这种情况时似乎不会触发事件。
.change()
我怎样才能做到这一点?
您需要手动触发更改事件
前任:
$('<selector>').val('<value>').trigger('change')
使用那个
$("元素").trigger("变化");