title: Alternative method to get data in jQuery than to use parent() and next() repeatedly?
body: <p>I have an HTML Table of Task List Data that I am trying to get all the data values and store them to an object when a row is clicked on.</p>
  
  <p>I have a demo of some HTML and the JavaScript below that is all functioning just as I need it.</p>
  
  <p>The problem is that I know the jQuery part is really bad quality as it calls things like this...  </p>
  
  <pre><code>$taskEl.parent().parent('td').next().next().next().text()
  </code></pre>
  
  <p>I feel these can be improved but I am not sure how so.  Most of this was already done on an existing project that I am trying to clean up and this 1 section is really bugging me.</p>
  
  <p>I would appreciate any help in alternative ways to get the data please?</p>
  
  <p>Or if this is the most efficient way?</p>
  
  <p>Also if I need to I have access to modify some of the HTML if need to add new ID's or data attributes.</p>
  
  <p><strong>JSFiddle demo</strong>...when you click a link in the Task Title, it will print the values that it selected to the DOM for demo puirposes...: <a href="http://jsfiddle.net/jasondavis/2hkz0gp4/5/" rel="nofollow">DEMO</a></p>
  
  <p><strong>Demo JavaScript to get Task Data from the DOM Task List and create a JS Object with it:</strong></p>
  
  <pre><code>//Open Task Modal when a Task record is clicked in Task List
  $('body').on('click', '.taskName', function() {
  
  
      // Set and Cache Task ID from clicked on Task Item
      var taskId = $(this).parent().parent().parent().dataAttr('task-id');
  
      var $taskEl = $(this);
  
      // Populate Task Data Object from DOM values
      taskDataObject = {
          //projectId: projectTaskModal.cache.projectId,
          taskId: taskId,
          taskName: $taskEl.text(),
          taskDescription: $taskEl.next('.description').text(),
          taskStatus: $taskEl.parent().parent('td').next().text(),
          taskPriority: $taskEl.parent().parent('td').next().next().text(),
          taskTags: $taskEl.parent().parent('td').next().next().next().text(),
          taskCreatedDate: $taskEl.parent().parent('td').next().next().next().next().text(),
          taskModifiedDate: $taskEl.parent().parent('td').next().next().next().next().next().text(),
          taskDueDate: $taskEl.parent().parent('td').next().next().next().next().next().next().text(),
      };
  
  });
  </code></pre>
  
  <p><strong>Demo Task List HTML</strong>  </p>
  
  <pre><code>&lt;span id="projectIdPlaceholder" data-project-id="1234"&gt;&lt;/span&gt;
  
    &lt;table&gt;
  
    &lt;!-- test task list record 1 --&gt;
    &lt;tr id="task-row-1414135033730" data-task-id="1414135033730"&gt;
      &lt;td width="1%" class="task-checkbox"&gt;
        &lt;div class="status_update status-checkbox-Not-Started" data-id="1414135033730" data-status="Not Started" id="1414135033730"&gt;&lt;/div&gt;
      &lt;/td&gt;
  
      &lt;td width="59%" class="task-name"&gt;
        &lt;div&gt;&lt;span id="1414135033730-taskName" class="taskName strikethrough"&gt;Add a Plugin System similar to WordPress Action and Filter Hooks
          &lt;span class="open-description-icon open-description-icon-close" title"toggle="" description="" view"=""&gt;+&lt;/span&gt;
          &lt;/span&gt;
          &lt;div id="1414135033730-taskDescription" class="description" style="display: block;"&gt;Project module will Fire Events before and After key events and Plugins in a custom/modulename/plugins/ folder will load and be able to Listen for these Event Hooks and then run it;s own code before and after these actions are executed!&lt;/div&gt;
        &lt;/div&gt;
      &lt;/td&gt;
      &lt;td width="10%"&gt;
        &lt;div id="1414135033730-status" class="Not Started status"&gt;                 Not Started&lt;/div&gt;
      &lt;/td&gt;
      &lt;td width="10%"&gt;
        &lt;div id="1414135033730-taskPriority" class="priority"&gt;Low&lt;/div&gt;
      &lt;/td&gt;
      &lt;td width="10%"&gt;
        &lt;div class="type"&gt;Other&lt;/div&gt;
      &lt;/td&gt;
      &lt;td width="10%"&gt;
        &lt;div id="1414135033730-createdDate" class="createdDate"&gt;2014-10-24 07:18:41&lt;/div&gt;
      &lt;/td&gt;
      &lt;td width="10%"&gt;
        &lt;div id="1414135033730-modifiedDate" class="modifiedDate"&gt;2014-10-24 07:18:41&lt;/div&gt;
      &lt;/td&gt;
      &lt;td width="10%"&gt;
        &lt;div id="1414135033730-dueDate" class="dueDate"&gt;None&lt;/div&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  
    &lt;!-- test task list record 2 --&gt;
    &lt;tr id="task-row-1414135033731" data-task-id="1414135033731"&gt;
      &lt;td width="1%" class="task-checkbox"&gt;
        &lt;div class="status_update status-checkbox-Completed" data-id="1414135033731" data-status="Completed" id="1414135033731"&gt;&lt;/div&gt;
      &lt;/td&gt;
  
      &lt;td width="59%" class="task-name"&gt;
        &lt;div&gt;
          &lt;span id="1414135033731-taskName" class="taskName"&gt;Testing Task Record Number 2
          &lt;span class="open-description-icon open-description-icon-close" title"toggle="" description="" view"=""&gt;+&lt;/span&gt;
          &lt;/span&gt;
          &lt;div id="1414135033731-taskDescription" class="description" style="display: block;"&gt;My project task description for demo testing task record number 2!&lt;/div&gt;
        &lt;/div&gt;
      &lt;/td&gt;
      &lt;td width="10%"&gt;
        &lt;div id="1414135033731-status" class="Completed status"&gt;Completed&lt;/div&gt;
      &lt;/td&gt;
      &lt;td width="10%"&gt;
        &lt;div id="1414135033731-taskPriority" class="priority"&gt;High&lt;/div&gt;
      &lt;/td&gt;
      &lt;td width="10%"&gt;
        &lt;div class="type"&gt;Magento&lt;/div&gt;
      &lt;/td&gt;
      &lt;td width="10%"&gt;
        &lt;div id="1414135033731-createdDate" class="createdDate"&gt;2014-10-27 03:10:14&lt;/div&gt;
      &lt;/td&gt;
      &lt;td width="10%"&gt;
        &lt;div id="1414135033731-modifiedDate" class="modifiedDate"&gt;2014-10-27 03:22:24&lt;/div&gt;
      &lt;/td&gt;
      &lt;td width="10%"&gt;
        &lt;div id="1414135033731-dueDate" class="dueDate"&gt;06/21/2015&lt;/div&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>