jQuery - Find and replace text, after body was loaded

后端 未结 3 787
忘掉有多难
忘掉有多难 2020-12-05 05:31

I received some amazing help from others, concerning finding and replacing text with jquery.

The code below will find the word: \"Subject:\" and replace it with \"Na

3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-05 06:19

    You could try attaching an event to the ajaxStop event as well as on load:

    function replaceText() {
        var jthis = $(this);
        $("*").each(function() { 
            if(jthis.children().length==0) { 
                jthis.text(jthis.text().replace('Subject:', 'Name:')); 
            } 
        });
    }
    $(document).ready(replaceText);
    $("html").ajaxStop(replaceText);
    

提交回复
热议问题