Jquery change text between two elements

后端 未结 8 974
無奈伤痛
無奈伤痛 2020-12-06 10:48

I want to change text between two elements using JQuery, but I don\'t have any idea !

for example:


    T         


        
8条回答
  •  清歌不尽
    2020-12-06 11:13

    You use js replace function to substitute the text you want to replace Here is the example: http://jsfiddle.net/yangchenyun/8zFFc/

    Here is the code

    var replacedText = $('input[name=ch1]').parent().html().replace('This text must change !!!', 'replaced text');
    
    $('input[name=ch1]').parent().html(replacedText);
    

提交回复
热议问题