That code is a bit hard to read....
I would have written the html to be more semantic, instead of using
lots of div tags.

Still, the exact code if that was in css should be
div div div div.dp_properties     - so you can see why it reads a bit
confusing.

I like the idea of defining a tag and using its info though (dp_id) :)

I'm not sure i've fully answered your question though, so let us know
how  you go.

On Nov 26, 12:24 pm, Mark Lacas <[EMAIL PROTECTED]> wrote:
> Why does the code below show the values for the two alerts to be:
> bilbo and layout_1 ?
>
> I would have expected: bilbo and bilbo.
>
> I thought the cascading selectors would have chosen the dp_properties
> class that is the first child level of the selected div. . .not the
> dp_properties class buried two levels down (but appearing first in the
> DOM listing).
>
> I would have thought that I would have had to use more selectors to
> get into there specifically?
>
> This really breaks my thinking of how jQuery works.  Do I really need
> to know what elements are in between to know that a selector is
> working properly?  What syntax would I use to get the one I want (the
> last and outermost)?
>
> Thoughts, answers, fixes?
>
> Thanks,
> ml
>
> alert( $( "#395" ).attr("dp_id") );
> alert( $( "#395" .dp_properties" ).attr( "dp_id" ) );
>
> <div id="395" dp_id="bilbo">
>         <div class="dp_view_container">
>                 <div id="411"  dp_id="layout_1"  dp_id_num="411">
>                         <div class="dp_properties" dp_id_num="411" 
> dp_id="layout_1"></div>
>                 </div>
>         </div>
>         <div class="dp_properties" dp_id_num="395" dp_id="bilbo"></div>
> </div>

Reply via email to