[Solved] Change CSS when the current URL contains a certain string [closed]


<a href="#black">black</a>
<a href="#blue">blue</a>

<script type="text/javascript">
$(window).on('hashchange', function(e){
    var origEvent = e.originalEvent;
    resultdata = origEvent.newURL;
    var black = resultdata.match(/black/);
    if (black){
      console.log(black);
    }
});
</script>

6

solved Change CSS when the current URL contains a certain string [closed]