Stoppping click but unbind, :not and stopPropagation don't seem to work
I have a small piece of code that opens and closes and accordion on click (an allows a user to have multiple ones open at once).
- $('#accordion h3').click(function() {
- $(this).next().slideToggle('slow');
- return false;
- }).next().hide();
This works fine, but sometimes I have an input field inside the h3 and I don't want this to activate the accordion if it's clicked. I have tried several attempts, but i can't get anything to work. Any ideas?
Instead of just targeting the input I have the option to unbind the click on the h3 when required by clicking a link using this:
- $("#accordion a.edit").click(function() {
- $(this).closest('div.eachone').find('h3').unbind('click');
- }
But I have been having trouble reattaching the click when I want it back again. bind() doesn't seem to work.