last day (25 days later) » 

9:25 AM
0
Q: Can you have two different Jquery script on the same page?

user10I have two different jquery scripts. I have used the content editor to add these script to the same sharepoint webpart page. It seems like one script overrides the other. How can I have both of these script work at the same page?

 
Are both the scripts manipulating the same DOM elements? For both to run smoothly, they should be having different purposes. And do not load jQuery js twice.
 
What do you mean by not loading Jquery js twice? basically one of the script that I have is creating tabs and another one is for video slider. The code I found for these scripts are online. @harshalgite
 
I meant that to run your jquery you might have loaded a js file called "jquery.js" or "jquery.min.js" by using <script> tag. Make sure you load it just once on the whole page. Also can you paste both your js code here or screenshots maybe?
 
Can you please describe which 2 scripts or part of scripts are not working?
 
9:25 AM
Both the scripts are working ! But what happens is that I want both of these script in the same webpart page! When I plug in both script in different content editor, the first script that I put in one content editor works and the second one doesn't. Let's say that I used content editor to put in the tabs script first, it works and when I use another content editor to put in the video slider script, that doesn't work. But if I put in the video slider first , it works and the tab doesn't work
 
Both your cewp js files have jquery js (first lines in both codes) loaded. This isn't recommended. Please load just once in either of the cewp files. The issue is not here though. Are both your codes trying to change something on the same elements of page?
 
umm I think they are! I have different promoted links which are converted into tabs. and the same promoted links, I am trying to have it in the video slider as well! is that a problem?
 
Try debugging the code using browser's developer tool. Maybe your 1st script changes the elements in such a way that your 2nd script does not get its desired elements on the page.
 
okay! seems like because I am using the same promoted links on both of them one is overiding the other. Thank you!!!
 

  last day (25 days later) »