Is jquery .bind() deprecated?

前端 未结 4 1630
长情又很酷
长情又很酷 2021-01-17 23:11

Is jquery bind() deprecated or it can be used safely?

I see a lot of comments about bind() being deprecated in comments and answers across SO like: Jque

4条回答
  •  时光取名叫无心
    2021-01-17 23:22

    I don't believe its deprecated but on is the preferred method of attaching events.

    http://api.jquery.com/bind/

    Deprecated means they will be removing it in the future but their docs don't seem to say that.

    EDIT:

    As of jQuery 3.0 bind IS deprecated. The above link is still relevant but has since been updated. From their docs:

    As of jQuery 3.0, .bind() has been deprecated. It was superseded by the .on() method for attaching event handlers to a document since jQuery 1.7, so its use was already discouraged.

提交回复
热议问题