Reputation: 5860
I have a div container which class is popup
and when i click on it, it wont close which is what i want it to do
but inside i also have some anchor tags for some ajax requests which doesn't execute since i have return false on the parent container
$(".popup").click(function(e){
return false;
});
how can i make the ajax requests work and still keep the popup visible?
Upvotes: 0
Views: 145
Reputation: 100175
Not so clear with you question, but do you mean something like this:
$(".popup").click(function(e) {
alert("Parent");
e.preventDEfault();
});
$("#test").click(function(e) {
e.preventDefault();
e.stopPropagation();
alert("Clicked"); //run ajax request
});
See: jsFiddle
Upvotes: 1
Reputation: 34556
Put your return
statement at the end of the callback. Anything after it will not run.
Or, if the purpose is to prevent the event's default action, use e.preventDefault()
instead.
Upvotes: 0