This is a great writeup, and .closest is right on. One minor note, it would
be safer to use .find rather than .children in case any futher levels are
ever added in the future.

- Richard

On Tue, Jan 12, 2010 at 4:33 PM, Detlef <det...@lindenthal.com> wrote:

> T a r g e t :
> I want to have
> -- two jQ-UI-dialogs which are independent in styles, e.g.
> -- one of them without title-bar and buttonpane, but with some funny
> border.
>
> P r o b l e m :
> -- In UI, these dialogs do not have an ID of their own, so I cannot
> adress them directly like I can adress their text field:
>       $('#myDialog1').text('Hello world') ,
> instead I have to address the dialog by its CSS class; and the title
> bar similar, e.g.:
>       $('.ui-dialog-titlebar').hide() ,
> but this means that the title bar of both dialogs will hide, rather
> than only one.
>
> S o l u t i o n :
> I can address my dialog text field, because it has a unique ID:
> 'myDialog1', and from here I traverse upwards to the dialog  ("closest
> ()" searches the ancesters in the DOM tree) and from here downwards to
> the title bar ("children()" traverses downwards), e.g.:
>     $("#myDialog1").closest('.ui-dialog').children('.ui-dialog-
> titlebar').hide()
> or e.g.:
>     $("#myDialog1").closest('.ui-dialog').children('.ui-dialog-
> buttonpane').css({
>         top: '80px',
>         left: '70px',
>         opacity: .8,
>         background:"#ffcc99",
>         border:"8px dashed #f00"
>         });
>
> D e m o :
>     http://netzwerkstatt.de/jqui_zweiDialoge
>
> HF, Detlef
>
> --
> You received this message because you are subscribed to the Google Groups
> "jQuery UI" group.
> To post to this group, send email to jquery...@googlegroups.com.
> To unsubscribe from this group, send email to
> jquery-ui+unsubscr...@googlegroups.com<jquery-ui%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/jquery-ui?hl=en.
>
>
>
>
--
You received this message because you are subscribed to the Google Groups "jQuery UI" group.
To post to this group, send email to jquery...@googlegroups.com.
To unsubscribe from this group, send email to jquery-ui+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en.

Reply via email to