简体   繁体   中英

I want to replace the inner text of HTML tag

I have a fixed social bar in the left side of the single post, I want to change the text of a social button "fb Share", I tried it in many ways but no luck. Here is the link for checking the problem. I tried the following code:

$('.pw-button-facebook').contents().find('span.pw-button-type-looknative__txt').text('New text');

$('span.pw-button-type-looknative__txt:contains("Share")').html(function(i,h){
return h.replace('Share', 'New text');
});

$('.pw-button-facebook').contents().find('span.pw-button-type-looknative__txt').html('New text');

$('.pw-button-facebook span.pw-button-type-looknative__txt').contents().filter(function() {
return this.nodeType == 3
}).each(function() {
this.data = this.data.replace(/Share/, 'New text'); 
});

So if you can please help me. Thanks.

$('.pw-button.pw-button-facebook').find('.pw-button-type-looknative__txt').text('Test');

试试这个Facebook按钮。

errrr

$('.pw-button-facebook .pw-button-type-looknative__txt').html('cat')

Works for me...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM