Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

[jQuery] Select all block elements

Options
  • 22-05-2013 9:53am
    #1
    Registered Users Posts: 101 ✭✭


    How would you go about selecting all page elements that have a
    display: block;
    
    CSS property using jQuery?

    I need to apply some POST effects (such as shadows and filters) to these elements.

    My other solution is to add
    .isblock
    
    classes to my desired elements and apply effects, but it'd be too much work.
    Tagged:


Comments

  • Moderators, Education Moderators Posts: 1,863 Mod ✭✭✭✭Slaanesh


    http://jsfiddle.net/dATSf/3/


    This selects ALL elements on the page that are of display type block. This will include the HTML and body tags. You would need to use NOT selectors to exclude these.


  • Registered Users Posts: 101 ✭✭Ethan.Saaris


    Will this consider external CSS files?


  • Moderators, Education Moderators Posts: 1,863 Mod ✭✭✭✭Slaanesh


    It considers the state of the entire page at that point in time when the selector is run. If you have external CSS styling the page then this should pickup all the display types of type block for all elements. Don't forget that certain elements have that display type by default.

    I fixed the link on my original post.


  • Registered Users Posts: 101 ✭✭Ethan.Saaris


    Slaanesh wrote: »
    It considers the state of the entire page at that point in time when the selector is run. If you have external CSS styling the page then this should pickup all the display types of type block for all elements. Don't forget that certain elements have that display type by default.

    I fixed the link on my original post.

    Noticed the broken link, but I copied it and it worked.

    Thanks for your solution, I'll try it later today.


  • Registered Users Posts: 2,021 ✭✭✭ChRoMe


    Slaanesh wrote: »
    http://jsfiddle.net/dATSf/3/


    This selects ALL elements on the page that are of display type block. This will include the HTML and body tags. You would need to use NOT selectors to exclude these.

    Wow long time no see fellow original Quake poster!


  • Advertisement
Advertisement