jQuery actually has a convenient syntax for binding events to an element but filtering the event target:

```javascript
$(document).on('click', '.share a', function() {

});
```

I'm not sure that's what you want, thought. The intended effect is to hide the share box if anything outside of it is clicked, right? Then something like this should* work:

```javascript
$(document).on('click', ':not(.share)', function() {

});
```

*This may not work exactly, I've had issues with `:not` in `on` handlers before, but it's close.