A bit stuck on getting hash equals to data attribute. so if url.com/#house-2 then it will trigger a click for test 2. How do you get it via jquery? <http://jsfiddle.net/ar1bd4bj/7/> 

```
<ul class="list">
    <li> 
<a  data-loc="house" href="#">test</a>        
    </li>
<li>
<a  data-loc="house-2" href="#">test2</a>
</li>
    <li>
<a  data-loc="house-3" href="#">test3</a>
</li>
</ul>

<script>
$(window).load(function() {

if (window.location.hash === data('loc')) {         
      setTimeout(function() {
        $('this').trigger('click');
    },1);           

  } 
 });

</script>

```
['https://Stackoverflow.com/questions/33084866', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4939773/']
You can use [`attribute equals`](http://api.jquery.com/attribute-equals-selector/) to select your target `a` element and trigger `.click()` like this;

```
$('.list a[data-loc="' + window.location.hash.replace('#', '') + '"]').trigger('click');

```

If your HTML contains those `data-loc` attributes, this will work. But it won't work if data was added via jQuery `.data()` function.
You can use `filter()` to find the required element by the `data-loc` attribute. Try this:

```
var fragment = window.location.hash;
if (fragment) {
    fragment = fragment.substr(1);
    $('.list a').filter(function() {
        return $(this).data('loc') == fragment;
    }).click(); 
} 

```