I am trying to get a function to trigger if the text inside of a span class changes. As you can see I want to just display an alert box when the span class with the class name ddlabel
is changed.
Ideally, I then want to check to if the text of the span matches a certain value.
$(function() {
$('span.ddlabel').on('DOMSubtreeModified',function() {
alert("run");
});
});
Here is the code for the span class I am trying to access to check if the text has changed and to grab the text value of.
<span class="ddTitleText " id="selectbasic_0_0_3_2_title" data-trn-key="Choose an option...">
<span class="ddlabel trn" data-trn-key="2 ">2</span>
<span class="description trn" data-trn-key=" "></span>
</span>