Suppose i have the following html:
<button class="inforTextButton" id"myButton">
<span class="leftSlice"></span>
<span class="centerSlice">Approved</span>
<span class="rightSlice"></span>
</button>
If i call the following command in jQuery:
$("#myButton").text("New Text");
It will replace all the spans with the text.
Is there anyway to detect this event? What i would like to do at that time is prevent it from replacing all the contents and instead change the centerSlice.
Now I know i could call: $("#myButton").find(".centerSlice").text("New Text") but thats not what exactly the point of my question. In case in the future my button implementation changes and I am trying to see if this is possible in some way to detect which i am missing..
I tried textchange – seems like this does not fire on buttons.
Thanks
The text function is stored in
$.fn.textthis means what you can do is replace that function:If you want to revert the jQuery text function: