When working with an identifier can create a lot of redundancy, it is better to work with classes, but if your classes will be repeated, and maybe a little difficult to handle, I would recommend that you use some custom attributes for this
Sample code for you.
var spnActive = document.createElement("span");
$(spnActive).attr('isExpColSpan', 'true');
$('#dvContainer').find('span[isExpColSpan="true"]').
In the second line, I added a custom attribute in the next line. I showed how to use this attribute.
source
share