JSFiddle - React, Tailwind, and code Playground
HTML
<div id='testdiv'>
<a dir='hello' href='#' ></a>
</div>
<input type='button' id='btn' />
JavaScript
$('#btn').on('click', function(){
if ( $('#testdiv a').attr('dir') == 'hello' ) {
alert('1111111');
}
else
alert('222');
});