jquery find and replace text, without element id

前端 未结 5 1717
鱼传尺愫
鱼传尺愫 2020-12-05 20:06

I\'m playing around with finding and replacing text.

The only problem I\'m having is finding a text string, that is not attached to an element with an ID. Otherwise

5条回答
  •  南方客
    南方客 (楼主)
    2020-12-05 20:28

    $("*").each(function () { 
    if ($(this).children().length == 0){ 
         $(this).html($(this).html().replace(/Old String/g, "New String"));
    }});
    

提交回复
热议问题