JSFiddle - React, Tailwind, and code Playground HTML <li><a href="" id="foo">text</a></li> JavaScript $('a[id]').parent().addClass('active');