I think they have complicated too much, select should provide you with the value you really need, which is the periodicity, and the price is that it should come as an attribute date, and only the value without formatting...
I recommend something like this:
HTML: (only the modifications)
Change the attribute value
for the periodicity and create the attribute data-preco
with the price:
<select class="select-ciclos" name="select">
<option value="mensal" selected="selected" data-preco="6,99">Mensal</option>
<option value="trimestral" data-preco="28,77">Trimestral -4%</option>
<option value="semestral" data-preco="54,14">Semestral -8%</option>
<option value="anual" data-preco="99,99">Anual -16%</option>
</select>
Jquery:
$(".select-ciclos").heapbox({
'onChange': function (value, src) {
$(src).closest('.pricing-column').find('.trans').animate({
opacity: 0
}, 250, function () {
$(this).children('span').html($(src).find("option:selected").attr("data-preco"));
if (value == 'mensal') var ciclo = '/mês';
if (value == 'anual') var ciclo = '/ano';
$(this).html( $(this).html().replace(/<\/span>.*/g, '</span>' + (ciclo ? ciclo : '')) );
$(this).animate({
opacity: 1
}, 250)
})
var elementolink = $(src).closest('.pricing-column').find('.pricing-footer a');
var link = elementolink.attr("href");
elementolink.attr("href", link.replace(/periodo\=(.+?)(&|$)/g, 'periodo=' + value + '&').replace(/&$/g, ''));
}
});
See working on Jsfiddle
It was very good, however, I forgot to mention one thing... Each table of this is a different product, IE, 3 different tables. Then you have to make a change in this jQuery. Ex:
http://meusite.com/carrinho.php?produto=1&periodo=mensal
andhttp://meusite.com/carrinho.php?produto=2&periodo=mensal
andhttp://meusite.com/carrinho.php?produto=3&periodo=mensal
– Alexandre Lopes
I changed the Fiddle link there in the answer, I created another data-product attribute in the combo, so for each product you have to feed this attribute.
– Euler01
Check it out: http://jsfiddle.net/AlexandreBR/23met8eu/5/ I made some changes to the HTML you forgot. They were all like
produto1
– Alexandre Lopes
It seems that was perfect, I will do some tests, if all goes well, I come here and give as best answer. : D Thanks!
– Alexandre Lopes