Eduardo Fuerte
asked on
How to use the same jquery code in two diferents parts of the same page?
Hi Experts
I need to use a the same code in 02 parts of the same page with diferente contents:
My page use this tab near the top
I need to use it again in the botton part of the page (another similar tab with other content)
What must be changed in the 2nd use of the tab?
Thanks in advance!
I need to use a the same code in 02 parts of the same page with diferente contents:
My page use this tab near the top
<ul class="tabs">
<li><a href="#tab1" class="selected"> O que é ?</a></li>
<li><a href="#tab2">PPAIS</a></li>
<li><a href="#tab3">PNAE</a></li>
</ul>
<div class="tab" id="tab1" style="display: block;">
<p style="text-align:justify"> Texto descritivo o que é ?</p>
</div>
<div class="tab" id="tab2">
<p>Texto descritivo do PPAIS</p>
</div>
<div class="tab" id="tab3">
<p>Texto descritivo do PNAE</p>
</div>
<script>
$(function() {
$('ul.tabs li a').click(function(e) {
e.preventDefault();
if (!$(this).hasClass('selected')) {
$('.selected').removeClass('selected');
$(this).addClass('selected');
$('.tab').hide();
$($(this).attr('href')).show();
}
});
});
</script>
I need to use it again in the botton part of the page (another similar tab with other content)
What must be changed in the 2nd use of the tab?
Thanks in advance!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You are most welcome again
ASKER