#1
  1. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Dec 2006
    Location
    IL, USA
    Posts
    584
    Rep Power
    22

    Way to select (jQuery) :after css elements


    I have/want to put in some buttons for a div element using :after - i have them styled and everything, just I want them to be able to be clickable in order to do the action.

    I have tried a number of ways to do this via jQuery, yet no luck - are :after/:before elements not DOM?
  2. #2
  3. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,131
    Rep Power
    4304
    Correct. Pseudo-elements are not part of the DOM. I'd recommend that you make the parent of the button large enough so that the :after and :before stay within its bounds and apply the event handler to both the button and its parent (to work with all input devices).
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).

IMN logo majestic logo threadwatch logo seochat tools logo