Accessing a specific class within a div tag.
Suppose I have the following HTML code:
- <div class="one">
- <a href="http://jquery.com/">jQuery</a>
- </div>
-
- <div class="two">
- <a href="http://google.ca/">Google</a>
- </div>
And the following bit of jQuery:
- $("div").dblclick(function(event){
- event.preventDefault();
- $("a").hide("slow");
- });
-
- $("a").click(function(event){
- event.preventDefault();
- });
Basically I want to recognize which <div> tag was double clicked, and hide the corresponding link that is nested within that specific <div> tag.
The only way I can think to do this currently is to basically copy and paste a whole bunch of jQuery code for each <div> tag and it's sub-elements (links in this case).
Hopefully this all makes sense - I'll try to clarify if it's confusing.