Search code examples
prototypejs

Selector up first not visible div


This works:

$('myform').up('div[display:none]')

I'm looking for the first ancestor div element who's display is none however I'm wondering if this is cross-browser. Is it?

Thanks.

Karl..


Solution

  • the [] CSS selector is for attributes and not styles.

    you could do

    $('myform').up('div[style~="display:none"]')
    

    but it wont be as reliable as you think