PDA

View Full Version : Tab Content Script: Change content selector to class



konstikonst
02-05-2011, 08:50 PM
1) Script Title:
Tab Content Script
2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex17/tabcontent.htm
3) Describe problem:

Hey guys,

as described I'd like the Tab Content Script to get the displayed content not by its ID (eg <div id="tcontent1">) but by class (eg <div class="tcontent1">).

Example

Instead of



<div id="tcontent4" class="tabcontent">
Tab content 4 here<br />Tab content 4 here<br />
</div>
<div id="tcontent5" class="tabcontent">
Tab content 4 here<br />Tab content 4 here<br />
</div>
<div id="tcontent6" class="tabcontent">
Tab content 4 here<br />Tab content 4 here<br />
</div>
<div id="tcontent7" class="tabcontent">
Tab content 4 here<br />Tab content 4 here<br />
</div>


The Javascript should take the content out of this structure:



<div class="tcontent4 tabcontent">
Tab content 4 here<br />Tab content 4 here<br />
</div>
<div class="tcontent5 tabcontent">
Tab content 4 here<br />Tab content 4 here<br />
</div>
<div class="tcontent6 tabcontent">
Tab content 4 here<br />Tab content 4 here<br />
</div>
<div class="tcontent7 tabcontent">
Tab content 4 here<br />Tab content 4 here<br />
</div>


I already tried just changing the html but the JavaScript does not get the content then.

I hope anyone can help me.