I've come across a piece of code that utilizes an unfamiliar selector that I can't seem to figure out:
$("div[tag=" + someVariable + "]").css("display", "block");
From what I gather, the selector is searching for a div
element with an attribute named tag
, where the value matches someVariable
.
What exactly is the purpose of the tag
attribute? Despite numerous Google searches, I haven't found any clear answers.
EDIT: Here's another line of code:
$("div[tag=" + someVariable+ "]").addClass("someClass");
Is it possible that this code snippet generates a new div
with a custom attribute, and then appends it to the content?