I am new to JQuery and I'm taking it slow. In my Tampermonkey script, I have included the following line of code and executed it on the desired page.
$('<span id="matrixVarTableInit">Default Rule Tests</span>').insertAfter( "div:contains('Default Rule').rule-name" );
My expectation was that this code would insert the provided HTML (the span) after the div that contains the text 'Default Rule' and has the class 'rule-name'.
However, instead of doing that, it is inserting the HTML snippet after every div with the class 'rule-name' (without considering if the tag includes the text 'Default Rule').