I'm currently using JS (items[i].id;) to successfully get the id of selected items in a list view, however, I would like to pull column values from the selected row(s) like "Title" etc. if possible using JS\JQuery. Is there a method for doing this by traversing the DOM instead of using the GetItemById method? Thanks!

Here is the code I'm using...

function WriteSelected() {
    var ctx = SP.ClientContext.get_current();
    var items = SP.ListOperation.Selection.getSelectedItems(ctx);
    var i;

    for (i in items)
            //alert (items[i].id);
  • Please share the code snippet that you are using currently to get the item ID. Apr 19, 2017 at 14:14
  • Do you mean you want to use Fields not displayed in the View ?? Apr 19, 2017 at 14:59
  • No sir. The values I want are already columns in the view. My end goal is to take those values and write them to another list.
    – Ghoztrider
    Apr 19, 2017 at 15:08

2 Answers 2


There is an object exposed by Sharepoint that you can use which is called WPQ2ListData which contains the current information of the list/grid.

Here's an example snippet to achieve what you need:

var ctx = SP.ClientContext.get_current();
var items = SP.ListOperation.Selection.getSelectedItems(ctx);
   console.log('Id selected: ' + item.id);
   var listItem = WPQ2ListData.Row.filter(function(row){
        return row.ID == item.id;
 console.log('List Item:');

I am not sure why you want to use the DOM instead of the ctx object...


Gets you the Item ID of all selected TRs

  • Honestly, I don't need the id's of the selected items unless I need to get the value of the columns from the GetItemById method. I just want to get the field values as efficiently as possible and run..
    – Ghoztrider
    Apr 19, 2017 at 15:41
  • Then do a .map to get the selected IDs and then a ctx.ListData.Row.filter() ? Apr 19, 2017 at 15:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.