SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: JQuery syntax

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Dec 2009
    Posts
    301
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JQuery syntax

    Here is a JQuery tutorial which I don't understand.

    $("[href!='#']") =>select all elements with an href attribute NOT equal to "#".

    $("[href$='.jpg']") =>select all elements with an href attribute that ends with ".jpg".

    what is the $ inside ? what it does there ? There is already a $ outside . I guess $ has something to do with the href attribute that ends with . But how ? Could you please throw somelight on this syntax ? Can I apply this any other places ?

  2. #2
    SitePoint Guru Ruben K.'s Avatar
    Join Date
    Jun 2005
    Location
    Alkmaar, The Netherlands
    Posts
    693
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The blue $ is the method name attached to the jQuery object, the red $ is a search modifier (the opposite of '^', ^: starts with..., $: ends with...) for use within sizzle (the CSS selector matcher)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •