Try this:

$(".cartSummaryItem").each(function(){
   $(this).html($(this).html().replace(/,[^<]*/, ' '));
});

It takes the html content of the cartSummaryItem table cell, and replaces everything from the comma to the start of the View Cart link with a space, then resets the contents of the table cell with the results. You could do it with a more complex regular expression, but you already have two delimiters (the comma and the start tag of the link) so there's no need.



on 23/01/2009 00:53 Wacko Jacko said::
Hi There,

I am using a CMS product that does not enable me to hide cart totals
from their cart summary. I need to do this for this particular client.

Here a snippet of code for the rendered page:

<span id="catCartSummary" quote="False" vertical="False"><table
cellspacing="0"  class="cartSummaryTable"><tr><td
class="cartSummaryItem">2 item(s), Total: $0.00 <a
class="cartSummaryLink" href="/OrderRetrievev2.aspx?
CatalogueID=34987">View Cart</a></td></tr></table></span>

I would like to hide (or remove) from the exact following section: ,
Total: $0.00\

So everything from the 'comma', the word 'Total' and all other numbers
and the $ sign. The 'View cart' I am already replacing with the
following code:

$(document).ready(function() {
$(".cartSummaryLink").html("View enquiry list");
});

Thanks in advance for your help.


Reply via email to