Selecting entire row in a table

Hi there,
I have a table created like below.  I want to be able to select one row( change the entire row to different color) and to be able to use the row data.   How can I do it?  thank you.
I want to be able to multi-select and create a list of row items that are selected.

       
 var __createAvailableResourcesTable = function(resources){
        var availableResourcesTable = document.createElement("table");
        availableResourcesTable.id = "AvailableResourcesTableID";
        
        resources.forEach(function(entry){
            var rowEntry = __createResourceRowEntry(entry);
            availableResourcesTable.appendChild(rowEntry);
        });
        return availableResourcesTable;
    };

        

Open in new window

ambuliAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
Can you explain what you want to use the row data for - when you will use the data (is this part of creating the table - if not what triggers the process).

What criteria do you want to use to select a row (clicking on it for instance)

Please fill in the gaps.
0
ambuliAuthor Commented:
Thanks. The user click on a row to select the row data, the row will be used to populate another row in a similar table.  For example, I have two tables displayed side by side and the user selects an item from the first table and 'moves' that to the next table.  This is to be done by first user selects the rows from the first table and then clicking an arrow indicating the items to be moved to the next table.
0
Julian HansenCommented:
So you want something like this
<script>
$(function() {
  $('tr').click(function() {
    $(this).toggleClass('selected');
  });
  $('#move').click(function() {
    $('tr.selected').clone().appendTo('#target');
  });
});
</script>

Open in new window


Working sample here
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ambuliAuthor Commented:
Thank you!
0
Julian HansenCommented:
You are welcome.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.