-2

jQuery accordion and bootstrap carousel on same page doesn't work. If one works then other doesn't.

I tried with different jQuery versions but can't find a way for them to work together. Anyone has any idea?

user6542823
  • 1,396
  • 2
  • 14
  • 24
  • I am creating accordion html dynamically through javascript and the carousel is standard (what is present on bootstrap website). The problem is that if I use jquery version between 1.9.1 and 2.2.4 then carousel would work AND at the same time, accordion would stop working. If I use jquery version less than 1.9.1 (or greater than 3.0.0), then accordion would work but carousel won't. Both work independently with change in jquery version but they won't work together and that is the issue. – user6542823 Jul 21 '16 at 03:33
  • I mentioned Accordion here but I have tabs and a datatable on the page as well. And the accordion, datatable, tabs neither work if I try to make carousel work. Moreover, I am creating all these (accordion, datatable, tabs) dynamically i.e. through javascript. The data for these comes from database (ajax call). So, I don't even think about changing all this logic. Is there anyway I can make it work? – user6542823 Jul 21 '16 at 03:40
  • Step 1: Create a Static HTML prototype of what you are trying to achive and get that to work,. Step 2: Modify your dynamic code based on what you leaned in Step 1. No mater what, when posting a question on Stack Overflow, provide code so we don't have to guess what you have done wrong or what, precisely is not working. Better still provide a [MCVE](http://stackoverflow.com/help/mcve) – Jon P Jul 21 '16 at 03:55
  • Since we can't see the code ur using there is no way to tell what the issue is but you may consider just using bootstraps accordion that is already in place and you wouldn't need extra code check out the followoing link and scroll to the bottom for bootstrap's accordion http://www.w3schools.com/bootstrap/bootstrap_collapse.asp – Steve K Jul 21 '16 at 04:01
  • Thanks Jon! I tried to do a jsfiddle with static content and it seems to be working in jsfiddle i.e. I can see the bootstrap carousel working with jquery accordion. I am looking more into how my script is conflicting with other .js – user6542823 Jul 21 '16 at 04:32

2 Answers2

0

I guess they have some names in common. Try using the jquery's noConflict to reset the usage of $.

Dev Agrawal
  • 737
  • 8
  • 10
  • I did but it didn't solve any problem. I tried using different versions of jquery for noConflict (one that makes carousel work and one that makes accordion work) but nothing. :( – user6542823 Jul 21 '16 at 03:49
0

The problem was not with the carousel or accordion. It was the radio button click event not working. The solution was found at: click event not firing within a bootstrap radio button group

Thank you all for your valuable time.

Community
  • 1
  • 1
user6542823
  • 1,396
  • 2
  • 14
  • 24