Hey,
I was wondering if someone could help me with this.
I want to, when an anchor link is clicked, the id of the link is grabbed by jquery then passed to a function. The id is would be the same as the id of the div that is used for the function (highlight).
If someone could tell me or point me in the right direction.
Here is what I have right now.
<script type="text/javascript">
$(function(){
$('#mainq a').click(function(){
var id = this.id();
$('this.id').highlightFade({speed:2000});
});
});
</script>
The HTML is like this (its for FAQ section):
QUESTIONS SECTION:
<div id="mainq" style="padding:10px;" class="mainq"><a name="top"></a>
<h3>Payment and Billing.</h3><br />
<a href="#aq1" id="qa1" onclick="javascript: getID(this)">What is water?</a><br />
<a href="#aq2" id="qa2" onclick="javascript: getID(this)">What is copper?</a><br />
</div>
<h3>Payment and Billing.</h3><br />
<a href="#aq1" id="qa1" onclick="javascript: getID(this)">What is water?</a><br />
<a href="#aq2" id="qa2" onclick="javascript: getID(this)">What is copper?</a><br />
</div>
ANSWERS HERE:
<div id="maina">
<hr /><div id="qa1" class="answertext"><a name="aq1"></a><h3>What is Water?</h3>
Water is H2O.<br /><a href="#top"><img src="images/top_arrow.jpg" border="0"/></a></div>
<hr /><div id="qa2" class="answertext"><a name="aq2"></a><h3>What is Copper?</h3>
Copper is cu.<br /><a href="#top"><img src="images/top_arrow.jpg" border="0"/></a></div>
</div>
The code is a little messy but I am just testing right now.
So if someone clicks on #aq1 link the id "aq1" is grabbed and used for the highlightFade function. It would highlight the div with id "aq1".
Thanks so much for any help