0

I am using the accordion plugin, and when a user click anywhere on the page that is not the accordion I want the accordion to collapse any open lists.

The code I have below works in the sense that it collapses the accordion, but it still collapses it wheni click on it.

What I am lookin for (i think), is a selector that will select everything, and then remove things like #accordion, and any li's that are related to the accordion.

$('html').not('#accordion, li').click(function(){

        collapseAll();              
});
dan1st
  • 12,568
  • 8
  • 34
  • 67
callum.bennett
  • 678
  • 3
  • 12
  • 28

2 Answers2

0

html selector is wrong here. You want all items but #according. And this will be

$('*').not('#accordion, li').click(function(){

        collapseAll();              
});
archil
  • 39,013
  • 7
  • 65
  • 82
0

SOLVED

Use jQuery to hide a DIV when the user clicks outside of it

Just incase anyone stumbles across this question, i found my answer here ^^

Community
  • 1
  • 1
callum.bennett
  • 678
  • 3
  • 12
  • 28