Is jquery .bind() deprecated?

前端 未结 4 1600
长情又很酷
长情又很酷 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:24

    It's not deprecated in jQuery 1.1. There is actually no difference (apart form it's usage) in version jquery 1.11.3 if you inspect the declaration of the .bind event you can see it simply calls .on:

    bind: function( types, data, fn ) {
        return this.on( types, null, data, fn );
    },
    

    deprecated or it can be used safely?

    As others say, no it's not deprecated and is safe, it's just a bit redundant now and only exists for backwards compatibility.

    Though it does seem to of been marked as deprecated in later versions of jquery now

提交回复
热议问题