Can you call a different version of jQuery just to use for a script? -
this question has answer here:
if site you're editing using 1 version of jquery, , upgrading breaks lot, , new script you're working on needs newer version, there way call , use newer jquery within script such doesn't affect rest of site?
take @ http://api.jquery.com/jquery.noconflict/. have example of using 2 different versions of jquery. isn't recommended though.
<!doctype html> <html> <head> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> </head> <body> <div id="log"> <h3>before $.noconflict(true)</h3> </div> <script src="http://code.jquery.com/jquery-1.6.2.js"></script> <script> var $log = $( "#log" ); $log.append( "2nd loaded jquery version ($): " + $.fn.jquery + "<br>" ); /* restore globally scoped jquery variables first version loaded (the newer version) */ jq162 = jquery.noconflict(true); $log.append( "<h3>after $.noconflict(true)</h3>" ); $log.append( "1st loaded jquery version ($): " + $.fn.jquery + "<br>" ); $log.append( "2nd loaded jquery version (jq162): " + jq162.fn.jquery + "<br>" ); </script> </body> </html>
Comments
Post a Comment