Question

I'm working on a project with codeigniter and every section of project is separate as a view file.

in header file jquery is included and in calendar section i need to jquery but i should include it again to work calendar correctly.

but when i call it again calendar work correctly but some others section like image slider faced with problems.

i think this is cause of jquery duplicate.

in calendar section just i need jquery to load a pop up box.

so please help me to solve this problem.

Was it helpful?

Solution

Well multiple copies jquery lib does cause your page to act abnormally , as it is said here in jQuery forum,http://forum.jquery.com/topic/multiple-copies-of-jquery-causing-issues .

You can add a condition in your view file to check if jQuery is already loaded or not. based on that you load the jQuery lib

if(typeof jQuery=='undefined') {
   var headTag = document.getElementsByTagName("head")[0];
   var jqTag = document.createElement('script');
   jqTag.type = 'text/javascript';
   jqTag.src = 'jquery.js';
   jqTag.onload = myJQueryCode;
   headTag.appendChild(jqTag);
}

Happy Coding :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top