Home

CSS Selectors and #

I’m sure everyone knows this but me, so bare with me, but did you know that #PageElementName in the browser goes to the element with the ID PageElementName?  We all know the stupid <a name="PageElementName" /> business, but it seems like the browser goes to the ID if it can’t find something with that name. 

I was passing some commands in the query-string for an Ajax application I was writing when I noticed that whenever I passed #transcript, it was scrolling down the page.  I should really read a book on web-browsers or something. [END TRANSMISSION] 

Related Posts

5 Responses to “CSS Selectors and #”

  1. Daniel F says:

    Dang. The things you learn. Thanks!

  2. The name attribute has been “formally deprecated, and will be removed in a subsequent version of XHTML.” According to the W3C.

  3. Jonathan says:

    I was tired of giving input fields name and id ;-) Thanks, Paul!

  4. hink says:

    This behaviour was built into HTML from its inception, actually.

    getElementById is your friend. Pretty amsuing, though, that loads of people are messing with this “AJAX” voodoo without a basic grasp of the DOM.

  5. Jonathan says:

    What scares me is that everyone is messing around with DHTML and Ajax without a basic knowledge of O-O. Just wait for the function collisions :D

Leave a Reply