JSFiddle - React, Tailwind, and code Playground

HTML

<h1>Description</h1>

<p>The .attr() accessor doesn't seem to work for retrieving a hash: <a href="http://api.jquery.com/attribute-equals-selector/">http://api.jquery.com/attribute-equals-selector/</a></p>

<h1>Example:</h1>

<p><a href="#city" id="example">City</a></p>

<p>Using <strong>$el.attr('hash')</strong>: <span id="attr-hash"></span></p>

<p>Using <strong>$el[0].hash</strong>: <span id="native-hash"></span>

CSS

p { margin: 10px; }
h1 { font-size: 1.2em; }
h1,strong { font-weight: bold; }

JavaScript

$(function() {
   $el = $('#example');
   $('#attr-hash').text($el.attr('hash'));
   $('#native-hash').text($el[0].hash);
});