Search code examples
jqueryattributesrel

jquery parsing rel attribute


For 1 param in rel I use:

<a rel="all">All</a> 
var group = $(this).attr('rel');

How to extract multiple rel attribute from link?

<a rel="all test1 test2">All</a>

TNQ!


Solution

  • var groups = group.split( ' ' );
    

    See this test.

    Or, if you want to account for possible repeated whitespace chars in between them

    var groups = group.split( /\s+/ );