I'm new to JQuery and I'd like to know if you've got any idea regarding how to accomplish the following with JQuery instead of JScript:
You have a group of a's within a top div:
<h3>
<a id="acer" href="#acerca">acerca</a> |
<a id="cur" href="#cursos">cursos y clases</a> |
<a id="cal" href="#calendario">calendario</a> |
<a id="con" href="#contacto">contacto</a>
</h3>
And below them, inside the same container div, there's four content divs, one after the other, each belonging to each of the a's above:
<div id="acerca"></div>
<div id="cursos"></div>
<div id="calendario"></div>
<div id="contacto"></div>
Now, the idea here is that we start off by closing all of these content div's but one, the first: acerca, which is visible to the user:
$(document).ready(function(){
$("#cursos,#calendario,#contacto").hide();
});
Now, using the h3 a's at the top, I want the following behaviour to take place:
1.- If I click a different item than the one open by default (acerca), then close the currently open one and show me the new one. 2.- If I click the same item which is already open (acerca), then nothing happens: there must always be one content div open at all times. 3.- If possible, using #anchors to mask the ugly "javascript:;" of the old days.
This is very simple with the use of JavaScript's onclick function (save for #3) but, I'm somehow getting stuck with JQuery.
Help is greatly appreciated Sotkra