Hi there,
I'm relatively new to jQuery and I'm struggling to
understand a problem I have with my event bindings.
I've created a toggle to show/hide the inner info of a three
divs. The functionality was ok if none of the sort buttons at the top
had been clicked.
If however, any of the top buttons were pressed, the toggle no
longer worked.
To try to get around the problem I've put my function inside
another event, but don't know how to remove the original without errors.
Here too is the code in question:
- $(document).on('click',
'.info', function(){
-
$('.switcher').click(function(event)
-
{
-
event.preventDefault();
-
console.log("Switcher clicked");
-
$(this).toggleClass('open');
-
$(this).parent().find(".info-inner").slideToggle("slow");
-
});
- });
Apologies for any confusion!