How can i click any "a" element what has a class that matches a table and show and hide the corresponding table ? I'm capable of doing toggle and specifying each class , but i want something dynamic that will match up any "a" class to any table that has matching class.
Here is sample HTML
<a class="franchise_0001">CLICK AND SHOW table.franchise_0004</a>
<a class="franchise_0002">CLICK AND SHOW table.franchise_0003</a>
<a class="franchise_0003">CLICK AND SHOW table.franchise_0003</a>
<a class="franchise_0004">CLICK AND SHOW table.franchise_0003</a>
<table class="franchise_0001" style="display:none">SHOW WHEN a.franchise_0003 is clicked</table>
<table class="franchise_0002" style="display:none">SHOW WHEN a.franchise_0003 is clicked</table>
<table class="franchise_0004" style="display:none">SHOW WHEN a.franchise_0004 is clicked</table>
<table class="franchise_0003" style="display:none">SHOW WHEN a.franchise_0003 is clicked</table>
I dont want to declare each one like i have now because the classes can change and i need to have a way to match any up
$("a.franchise_0004").click(function(){
$("table.franchise_0004").toggle();
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…