jQuery 'if .change() or .keyup()'

后端 未结 7 679
说谎
说谎 2020-12-13 05:26

Using jQuery i would like to run a function when either .change() or .keyup() are raised.

Something like this.

if ( jQuery(         


        
7条回答
  •  北海茫月
    2020-12-13 05:56

    you can bind to multiple events by separating them with a space:

    $(":input").on("keyup change", function(e) {
        // do stuff!
    })
    

    docs here.

    hope that helps. cheers!

提交回复
热议问题