Wrap text after . in a class

by andyjh07

HTML

<div class="price">£300.00</div>

CSS

.decimals { color: green; }

JavaScript

$(".price").html(function(i, html){
    return html.replace( /(\.)(\d+)$/, '$1<span class="decimals">$2</span>')
});