Change text with JS

I want to change these these strings on my checkout page: "Remove Card" and "I'll use a new card"

  • Ash
    • WordPress Hacker

    Hello Bamboo

    Please try the following code:

    jQuery(function($){
    	setInterval(function(){
    		var rmv_btn = $('input[name=btn_2c2p_remove]'),
    			option_val = $('#wc_2c2p_stored_card option:first');
    		if( rmv_btn.length )
    			if( rmv_btn.val() != 'new button text' ) rmv_btn.val('new button text');
    
    		if( option_val.length )
    			if( option_val.text() != 'new option value' ) $('#wc_2c2p_stored_card option:first').text('new option value');
    
    	}, 500);
    });

    Hope it helps! Please feel free to ask more questions if you have any.

    Have a nice day!

    Cheers,
    Ash

  • Ash
    • WordPress Hacker

    Hello Bamboo

    however which string that I can change the word to my language please let me know

    Would you please explain a bit more about this?

    also could you please make the word select my card change too.

    Please replace with the following code:

    jQuery(function($){
    	setInterval(function(){
    		var rmv_btn = $('input[name=btn_2c2p_remove]'),
    			option_val = $('#wc_2c2p_stored_card option:first');
    			card_lbl = $('#tblToken th');
    		if( rmv_btn.length )
    			if( rmv_btn.val() != 'new button text' ) rmv_btn.val('new button text');
    
    		if( option_val.length )
    			if( option_val.text() != 'new option value' ) option_val.text('new option value');
    
    		if( card_lbl.length )
    			if( card_lbl.text() != 'New Select my card text' ) card_lbl.text('New Select my card text');
    
    	}, 500);
    });

    Have a nice day!

    Cheers,
    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.