I have HTML code like this :
<div>
<a>Link A1</a>
<a>Link A2</a>
<a>Link A3</a>
</div>
<div>
<a>Link B1</a>
<a>Link B2</a>
<a>Link B3</a>
</div>
When user clicks a link from above HTML, I want to get the jQuery object of the corresponding <a>
element, and then manipulate its sibling. I can't think of any way other than creating an ID for each <a>
element, and passing that ID to an onclick event handler. I really don't want to use IDs.
Any suggestions?
question from:https://stackoverflow.com/questions/361717/select-current-element-in-jquery