0

My first dabble with JQuery. I wish to replace the delivery charge on checkout page from £0.00 to TBC (To Be Confirmed)

I have attempted this in a console in Chrome. With no success:

$( ".deltotal" ).replaceWith( "TBC" );

This is the field I am trying to change:

<td class="deltotal">£100.00</td>

I assume when I reach the right code I need to put the script at the footer of the checkout.tpl page?

2
  • 1
    If you just need to alter the inner text, you can use $( ".deltotal" ).text("TBC") Commented Feb 12, 2016 at 10:45
  • Our warehouse pickup price is £0.00 so we could do with that displaying when selected. But for £49.99 or £99.99 options we could do with being converted to TBC. Commented Feb 12, 2016 at 11:31

2 Answers 2

1
$('.deltotal')
     .filter(function () { 
         return $.trim(this.innerHTML) == "£0.00"; 
}).text('TBC');
Sign up to request clarification or add additional context in comments.

2 Comments

Isn't InnerHTML a potential security risk in Jquery?
@flint781 not really, if you know the element which you are operating on.
0

Please try this

$( "td.deltotal" ).text( "TBC" );

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.