I want to be able to trigger a function when a certain AJAX element is loaded. I'm using Brock Adam's excellent waitForKeyElements function to wait for a certain HTML element, which could appear via AJAX a long time after the main page is loaded. Normally I could use something like
waitForKeyElements( ".section-title", MyFunction );
to trigger MyFunction when the element with class section-title. Unfortunately, in this case there are multiple elements with class section-title; the one I'm looking for contains the text "Notes", something like this:
<div class="section-title"><h3>Notes</h3></div>
and it might or might not appear at all. I DON'T want to trigger if something else appears, like this:
<div class="section-title"><h3>Other Section Title</h3></div>
Is there any way to have waitForKeyElements trigger only when that specific text appears in that class of element? If waitForKeyElements is already triggered by the Other Section Title from the second example above, it will no longer be triggered by a later appearance of the correct Notes section from the first example above. I tried setting the bWaitOnce parameter to false, but waitForKeyElements still doesn't trigger for repeated appearances of elements satisfying the ".section-title" criterion. Thus, it would be futile to just use MyFunction to search for the Notes text.
Any help would be appreciated!