Is there a tag in html to which I can add an id attribute that does not affect the html page, but can still be accessed using the jQuery selector?
Here is an example:
<li><a href="#"><i class='fa fa-link'></i> <span>Another Link</span></a></li>
If I have the above code in the list, what tag can I add to this html so that I can then use jQuery to perform actions on the code elements as children?
The above code is just an example, I want to be able to use this method for any html element.
EDIT
Is the <span> tag what I'm looking for?
EDIT2
I tried the following with a span tag:
<span id="qwerty123"><li><a href="#"><i class='fa fa-link'></i> <span>Another Link</span></a></li></span>
However, the list items are not displayed correctly. I am using the AdminLTE template, and this template uses a custom style for these list items.
How else can I achieve the desired result? Can I add data attributes or some other html coding method?
EDIT3
An html tag with an identifier must be before any other tag, so that all other tags can be considered as child tags.
source share