jquery Prevent to call function

<div class="content">
    <div style="background:url(...jpg) no-repeat #01AEF0;" class="slide-small">
       <div><strong>Title</strong></div>
        <div class="read_more"><a class="t_10" href="http://example.com/">Read More</a></div>
     </div> 
</div>

When I click on the div that has a class="content" my code calls function. When I click on Read More the function is called and after that the new page opens. I need not to call the function, only open the href.

Answers


$('.read_more a').click(function(e){
   e.stopPropagation();
});

events like click bubble to ancestor elements. To prevent that event bubble further than your a element ... read this: http://api.jquery.com/event.stopPropagation/


$('div.content').click(function(e){
   if(e.target === this) {
        // Only then call your function
   }
});

Need Your Help

Why does running the Flask dev server run itself twice?

python flask

I'm using Flask for developing a website and while in development I run flask using the following file:

Working with meteor wizard steps?

twitter-bootstrap meteor twitter-bootstrap-3

I am working with planficca wizard where the wizard steps are on top of my wizard such that press when I press "next" it moves to the next step. I want the steps to be over to the left of the step ...