Ihm has earned achievement:.

 
Szychowski: Filter with a function is fast and, imo, far more readable.

Goldberger: That and you dont want to get bogged down by state when getting stuff from the dom

Tonsil: I know this is quite out of context, but can anyone help me understand what’s going on here without really knowing what these elements are? http://dpaste.com/2AXXZC9 more specifically this off stuff

Szychowski: That removes all event handlers for click

Szychowski: Http://api.jquery.com/off/

Szychowski: You can usually avoid those entirely.

Szychowski: Usually people do that because they’re accidentally re-binding their handlers and don’t know about the alternatives.

Sturrock: Well unfortunately this entire site is a ball of garbage and i cant much change it

Warrell: Its an old site so i jus thave to work with that is already here

Szychowski: What version of jquery?

Koncan: The client wants to add functionality for the mobile nav though that says if they click on a category once, it drops down, but if they click on it agin while its dropped down, instead of it closing, it wants to just go to that categoy page. i kinda hcaked a solution together by checking if its toggled down then using window.location.href but i jus

Guintanilla: T wish i could find where its disabling the event for the anchor in the first place

Szychowski: Can get it by doing $.fn.jquery in the console

Birkner: Its like 10,000 lines

Szychowski: It’s that e.preventDefault call.

Carmody: Yea but its not that call

Szychowski: Then something else is doing it, too.

Szychowski: You could have multiples doing it.

Barco: Yea see, they have prevent default in several places for the same elemnt

Mihor: So my solution does work but it just seems wrong

Szychowski: What’s your solution? check if it’s already open and if not, open the menu, otherwise go to the page?

Twichell: But i have to use window.location.href to get to the page

Mcgurren: Because i cant find where its being prevented

Limehouse: Just doin this: window.location.href = $this.attr’href’;

Szychowski: You could use your dev tools to see what handlers are bound to that element.,

Gerstner: Ive never learend how to debug js in the tools actually

Szychowski: Which browser’s tools are you using?

Szychowski: See on the right where you have “Styles”?

Szychowski: There’s an “event listeners” one.

Rentfro: Does the off’click’ . mean remove any click event?

Doran: Or remove all events and add a click event

Szychowski: Http://api.jquery.com/off/

Solhjem: So what event is it responding to inside the body of it then

Szychowski: That’s removing all click handlers for $cache.firstLevel and then attaching a new click handler to all of those

Bancks: Makes no sense though. if off removes it. theres no event firing to hit that?

Labier: Or does the click event do that

Kennealy: What makes this happen though

Szychowski: The event always fires fwiw, but this code immediately re-binds a click handler.

Casales: Click $el.click says when you click on el

Berthold: This is off. so its removing. theres no click event

Szychowski: The code you provided does .off’click’.click

Szychowski: There is a click event binding that gets first right after the .off

Galper: So its removing old ones and adding a new one

Szychowski: I already explained this earlier lol

Potvin: Anyway, im accepting this solution

Ihm: Your now one of my favorite people

Kruppa: Ihm has earned achievement: First correct your/you’re