Trigger js code on url tag name change

by Ben Clayton

HTML

<a href="#1001" target="_self">1001</a><br>
<a href="#1002" target="_self">1002</a><br>


<div id="1001">
        <image src="http://source-bc.local/product_images/_small/248.jpg" />
</div>

<div id="1002">
    <image src="http://source-bc.local/product_images/_small/249.jpg" />
</div>

JavaScript

$(window.location).change(function(){
   $('#1001').hide();
   $('#1002').hide();
    debugger;
   var url = window.location;
   var bits=url.split('#');
   $(bits[1]).show();
    
});