jquery find and replace multiple items

Posted by client on Stack Overflow See other posts from Stack Overflow or by client
Published on 2012-06-08T10:21:25Z Indexed on 2012/06/08 10:40 UTC
Read the original article Hit count: 379

Filed under:
|

I have a monthly table that needs to be translated for each languages

Something like this (doesnt work obviously)

$('.lang-en #monthly th').each(function() {
    var text = $(this).text();
    $(this).text(text.replace('Tam', 'Jan')); 
    $(this).text(text.replace('Hel', 'Feb')); 
    $(this).text(text.replace('Maa', 'Mar')); 
    $(this).text(text.replace('Huh', 'Apr')); 
    $(this).text(text.replace('Tou', 'May')); 
    $(this).text(text.replace('Kes', 'Jun')); 
    $(this).text(text.replace('Hei', 'Jul')); 
    $(this).text(text.replace('Elo', 'Aug')); 
    $(this).text(text.replace('Syy', 'Sep')); 
    $(this).text(text.replace('Lok', 'Oct')); 
    $(this).text(text.replace('Mar', 'Nov'));
    $(this).text(text.replace('Jou', 'Dec')); 
    $(this).text(text.replace('Yht', 'Total'));

});

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about replace