I would like to open email-signup
when I click on email-signup-link
. Then I would like to close it by clicking anywhere on the page except for the
Two things. You don't actually have e
defined, so you can't use it. And you need stopPropagation
in your other click handler as well:
$('#email-signup').click(function(e){
e.stopPropagation();
});
$("#email-signup-link").click(function(e) {
e.preventDefault();
e.stopPropagation();
$('#email-signup').show();
});
$(document).click(function() {
$('#email-signup').hide();
});
http://jsfiddle.net/Nczpb/