Finding text node

前端 未结 8 1314
半阙折子戏
半阙折子戏 2021-01-03 08:14

Is there a clever jQuery selector for selecting a text node like this:

one two three
8条回答
  •  天命终不由人
    2021-01-03 08:49

    //finds most inner element that has 'three' in it
    var el = $(':contains(three):last');
    //actual replacement
    el.html(el.html().replace('three', 'three'));
    

提交回复
热议问题