html - Jquery Conflict between versions -


i have app works placing following within html header

<link href="{{ media_url }}css/style.css" rel="stylesheet" type="text/css" media="screen" /> <link href="{{ media_url }}jquery/css/custom/jquery-ui-1.8.6.custom.css" rel="stylesheet" type="text/css" media="screen" /> <script type="text/javascript" src="{{ media_url }}jquery/js/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="{{ media_url }}jquery/js/jquery-ui-1.8.6.custom.min.js"></script> 

however want use new bootstrap styling requires following,

<script type="text/javascript" src="{{ media_url }}jquery/js/jquery-1.9.1.min.js"></script> <script type="text/javascript" src="{{ media_url }}jquery/js/bootstrap.min.js"></script> 

however mix 2 random bevaiour app, typically following error "uncaught referenceerror: jquery not defined".

how should doing ?

thanks,

if must have 2 version of jquery, not recommended, can use jquery.noconflict.

many javascript libraries use $ function or variable name, jquery does. in jquery's case, $ alias jquery, functionality available without using $. if need use javascript library alongside jquery, return control of $ other library call $.noconflict(). old references of $ saved during jquery initialization; noconflict() restores them.

if reason 2 versions of jquery loaded (which not recommended), calling $.noconflict(true) second version return globally scoped jquery variables of first version.

docs: http://api.jquery.com/jquery.noconflict/

but consider refactor code use 1 version of jquery , save time , pain.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -