I’m looking to create a jQuery script that will replace an html variable if and only if it is inside a certain div. I’d like it to do this for each PostID though.
Each variable is unique depending on the post id.
Example:
<div class="[PostID]">
<div class="special">
<div class="container">
(Variable 1 has been replaced by variable 2 here due to the Special class)
[Variable 2]
</div>
</div>
</div>
I created a quick script but the problem I have is that when the first variable 2 is replaced, that is also the variable that is used to replace the following special classes. They aren’t using their own variable.
Sorry if this is confusing.
Thank you.
You could iterate over the containers, replacing vars in one at a time with something like this: