2
I have items of which in a paragraph is displayed the total of them. When I remove one of these items, I am working with 2 paragraphs with the same code so that I hide one and show the other, so that I can display the correct value. However, when I click on the button that is to do this function, only one of them is changed, while the other continues with the original code.
Paragraph code:
<?php foreach($this->getItems() as $_index=>$_item): ?>
<p class="number" id="numberOriginal"><?php echo $this->__('Item %d of %d', $_index+1, $this->countItems()) ?></p>
<p class="number" id="numberModificado" style="display: none;"><?php echo $this->__('Item %d of %d', $_index+1, $this->countItems()-1) ?></p>
<?php endforeach; ?>
Code "triggers" this function:
$j('input[name=isgift]').click(function(){
if($j('#isgift1').is(':checked')){
mudarNumber();
}
});
Function code to change the <p>
:
function mudarNumber(){
$j('#numberOriginal').hide();
$j('#numberModificado').show();
}
Example:
Item 1 of that list <p>
gets that way:
<p class="number" id="numberOriginal" style="display: none;">Item 1 de 3</p>
<p class="number" id="numberModificado" style="">Item 1 de 2</p>
Item 2 of that list <p>
gets that way:
<p class="number" id="numberOriginal">Item 2 de 3</p>
<p class="number" id="numberModificado" style="display: none;">Item 2 de 2</p>
It worked, thanks for the help! D
– Matheus Portela