Quiero mostrar un párrafo haciendo clic en el botón con jQuery. Pero cuando está visible, quiero ocultarlo haciendo clic en cualquier lugar que no sea el botón (es decir, en cualquier lugar fuera del botón). Por ejemplo, aquí es mi código:jQuery ocultar si se hace clic fuera del botón
<p style="display: none">Hello world</p>
<button>Say Hello</button>
jQuery:
$("button").click(function() {
$("p").show();
});
aquí es jsFiddle enlace: http://jsfiddle.net/k9mUL/
Como puedo ocultarlo haciendo clic fuera del botón? Gracias
Este 'if ($ (event.target) .is (" button "))' me ayudó en este momento. Es tan fantástico jQuery en general es realmente precioso! ¿Cómo podría uno vivir sin eso ...: D –