2 JS functions with same name conflict

后端 未结 5 1065
野性不改
野性不改 2021-02-15 15:17

Short

Using 2 libraries at same page: jQuery UI and Twitter Bootstrap:

  • jQuery UI very important for me because nearly all UI things built based on it
5条回答
  •  既然无缘
    2021-02-15 15:44

    The current version of bootstrap (v2.2.2) now has a noConflict option. Just insert this some place after your bootstrap and jquery script tags but before any usage of the button() function.

    
    

    Alternatively, you can use $(document).ready(handler), but you still have to make sure substitution occurs before button() is called.

    Once that line of code is executed, button() will be JqueryUI's button, and bootstrapBtn() will be Bootstrap's version.

提交回复
热议问题