$("dl dt a").click(function (event) {
event.preventDefault();
event.stopPropagation();
$(this).parent().next().show();
});
Fil wrote:
>
>
> I want the expression to verify that the link is in the correct data
> structure, i.e. inside a <dt> that is inside a <dl> and where
> $(this).parent().next() is a <dd>.
>
> Said differently: I want to tell my script "if the link is inside a <dt>
> then show() the corresponding <dd> (if it exists)".
>
> That's why I was trying to use XPath and the parent::x syntax (and failed
> miserably, ha ha).
>
>
>> In the SVN build of jQuery you can do:
>>
>> $(this).parent().next().show();
>>
>> jQuery SVN can be found here:
>> http://jquery.com/src/jquery-svn.js
>>
>> --John
>>
>> > I have the following structure:
>> >
>> > <dl>
>> > <dt> url x </dt>
>> > <dd>text</dd>
>> > </dl>
>> >
>> >
>> > I select the element in this, and I want to show() the corresponding
>> dd.
>> >
>> >
>> > This works but is not very precise:
>> > $("../../dt/../dd", this).show();
>> >
>> > I'm trying to write it more precisely with something like:
>> > $("parent::dt/parent::dl/dd", this).show();
>> >
>> > but I'm not finding the correct expression...
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
>
--
View this message in context:
http://www.nabble.com/XPath-tf2106968.html#a5813465
Sent from the JQuery forum at Nabble.com.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/