Question: I'm creating shopping cart page that there's a div have a click listener for redirecting to the product page, but you also can select qty on the div. How can I prevent the redirection when selecting from `<select/>`

I've tried `event.stopPropagation()` / `e.preventDefault()` on select but not working

Here's the sample code.

<https://jsfiddle.net/hk7861es/2/>

Answer: 
You can test whether the target is the parent div by `event.target == this`

Example:

```
$('#box').click(function(event) {
    if ( event.target == this ){ 
          $('#text').append('You clicked');
    }
})

```

Fiddle: <https://jsfiddle.net/hk7861es/3/>
You can just exclude the `<select/>` from the click event.

```
$('#box').click(function(e) {
            if($(e.target).is('#select')){ 
            e.preventDefault();
            return;
        }
  $('#text').append('You clicked');
});

```

<https://jsfiddle.net/hk7861es/10/>