SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    John 8:24 JREAM's Avatar
    Join Date
    Sep 2007
    Location
    Florida
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JQuery Array Question

    Heya.

    I was wondering if I had something like this:

    Code HTML4Strict:
    <div class="test" rel="item|other|another"></div>


    Code JavaScript:
    var items = $(".test").attr('rel');

    Is there a way to explode these items into their own variable values?
    so like...
    Code JavaScript:
    item[0] = item
    item[1] = other
    item[2] = another

  2. #2
    SitePoint Addict sdleihssirhc's Avatar
    Join Date
    Feb 2009
    Posts
    387
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    The split method is probably what you'll want to use.

  3. #3
    John 8:24 JREAM's Avatar
    Join Date
    Sep 2007
    Location
    Florida
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks!!


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
  •