I have two different values that should return different answers, but the classes are the same, how to solve?
See that the answers are wrong.
.Container-Produto{display:block;border:solic 1px #ccc;}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><divclass="Container-Produto">
<div class="Preco">99,00</div>
<a class="Frete-a"></a>
</div>
<div Class="Container-Produto">
<div class="Preco">98,00</div>
<a class="Frete-a"></a>
</div>
<script>
jQuery("document").ready(function($){
$('.Preco').ready(function() {
var preco = $('.Preco').text();
preco = parseFloat( preco.replace( '.', '' ).replace( ',', '.' ) );
if( preco > 98.99 ) {
$('.Frete-a').text( 'Frete Grátis' );
} else {
$('.Frete-a').text( 'Sem Frete Grátis' );
}
});
});
</script>