1

I have created a simple drop down in my system for order which appears upon clicking an element just below it. I can toggle the menu hidden below it by clicking that element again. But I would like to catch clicks outside after that other than the options in the drop down itself to hide it so users can easily discard it if needs be. Is there an easy way in jQuery to achieve this. All im simply using at the moment for the toggling is clicks on a element which states the current order to hide and reveal with .is(':hidden').

Appreciate any help in advance.

4

1 回答 1

1

认为我实际上回答了我自己的问题。

发现 stopPropagation() 然后对 $('html').click() 进行绑定检查以查看元素是否为 (':visible') 和 hide();

谢谢你们的帮助。

于 2012-10-17T21:23:24.960 回答