Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7166043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:20:58+00:00 2026-05-28T14:20:58+00:00

I use this: http://datatables.net/release-datatables/examples/api/select_row.html Here is function return selcted rows: function fnGetSelected( oTableLocal )

  • 0

I use this: http://datatables.net/release-datatables/examples/api/select_row.html

Here is function return selcted rows:

function fnGetSelected( oTableLocal )
{
    var aReturn = new Array();
    var aTrs = oTableLocal.fnGetNodes();

    for ( var i=0 ; i<aTrs.length ; i++ )
    {
        if ( $(aTrs[i]).hasClass('row_selected') )
        {
            aReturn.push( aTrs[i] );
        }
    }
    return aReturn;
}

i do:

var arr = fnGetSelected(oTable);

this return me:

[tr.gradeA, tr.gradeA, tr.gradeA]

this is:

<tr class="gradeA even row_selected">
<td class=" sorting_1"><span class="my_values" test="aaa">Gecko</span></td>
<td>Camino 1.5</td>
<td>OSX.3+</td>
<td class="center">1.8</td>
<td class="center">A</td>
</tr>
<tr class="gradeA odd row_selected">
<td class=" sorting_1"><span class="my_values" test="bbb">Gecko</span></td>
<td>Netscape 7.2</td>
<td>Win 95+ / Mac OS 8.6-9.2</td>
<td class="center">1.7</td>
<td class="center">A</td>
</tr>
<tr class="gradeA even">
<td class=" sorting_1"><span class="my_values" test="bbb">Gecko</span></td>
<td>Netscape Browser 8</td>
<td>Win 98SE+</td>
<td class="center">1.7</td>
<td class="center">A</td>
</tr>

I add for this own span.my_values with attribute test.
Now i would like get all attribute test for this.

I try:

    arr.each(function(index) {
        console.log($(this).children());
    });

but this return error: arr.each is not a function

How can i make it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T14:20:59+00:00Added an answer on May 28, 2026 at 2:20 pm

    jQuery’s generic array looping function is $.each, not a member of Array.prototype, so:

    $.each(arr, function() {
        console.log($(this).children());
    });
    

    Now i would like get all attribute test for this.

    If you’d like to get the test attribute of the span with class “my_values” inside the elements in arr, you can use $.map:

    var testValues = $.map(arr, function() {
        return $(this).find('span.my_values[test]').attr('test');
    });
    

    …which gives you an array of the test values.


    Side note 1: Since you’re using jQuery, which is inherently set-based, rather than having your fnGetSelected function return an Array of matching elements, how ’bout having it return a jQuery object?

    function fnGetSelected( oTableLocal )
    {
        return $(oTableLocal.fnGetNodes()).filter('.row_selected');
    }
    

    That creates a jQuery object containing all of the returned nodes, then filters it to only the ones with the class “row_selected” (as your original did) and returns it.

    Then you can use it like this:

    var rows = fnGetSelected(oTableLocal);
    rows.each(function() {
        console.log($(this).children());
    });
    
    var testValues = rows.map(function() {
        return $(this).find('span.my_values[test]').attr('test');
    }).get();
    

    Side note 2: “test” is an invalid attribute for span elements, although browsers allow it. Look at using data-* attributes instead, e.g., “data-test” rather than “test”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use this function: http://www.frankmacdonald.co.uk/php/post-to-wordpress-with-php.html Its used to post to Wordpress using
I want to use this pure HTML/CSS template for my ASP.NET website: http://sub3.tanguay.de I
I'm trying to use this: http://api.jquery.com/jQuery.get/ and I don't understand why the examples look
According to this http://perldoc.perl.org/UNIVERSAL.html I shouldn't use UNIVERSAL::isa() and should instead use $obj->isa() or
I have downloaded the silver light from this http://www.microsoft.com/silverlight// I need to use this
I use this code: http://blogswizards.com/plugin-development/sliding-boxes-and-captions-with-jquery On a simple gallery site I am building. Specifically
I am currently trying to use this gem http://github.com/pengwynn/linkedin . Everything works fine (i.e.
I'm trying to to use this class http://robbyonrails.com/articles/2005/05/11/parsing-a-rss-feed but am not sure where to
I'm trying to train an ANN (I use this library: http://leenissen.dk/fann/ ) and the
I'm trying to use this php thumbnail generator http://phpthumb.gxdlabs.com/ and i keep getting the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.