title: Making row editable when hit row edit button
body: <p>I'm new to jQuery and JavaScript.  I'm trying to click on my Edit button in my table and make the entire row editable.  For some reason it's not working.  I think it's only looking at the cell the edit button is in, but I'm not sure how to make it change the entire row to be editable (except the edit button field).  I tried moving contenteditable to the tr tag level from the td tag level but it didn't fix it.  I was looking at <a href="https://stackoverflow.com/questions/17246648/make-html-table-editable-and-enable-a-per-row-button-when-text-changes-in-that">this link</a> as an example, but I think there's something I'm missing.  Here is what my code looks like:</p>
  
  <pre><code>&lt;head&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;script type="text/javascript" src="js/jquery-1.11.0.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
          $(document).ready(function() {
              $('#btnHide').click(function() {
                  //$('td:nth-child(2)').hide();
                  // if your table has header(th), use this
                  $('td:nth-child(3),th:nth-child(3)').hide();
              });
          });
      &lt;/script&gt;
      &lt;script type="text/javascript"&gt;
          $(document).ready(function(){
              $('.editbtn').click(function(){
              $(this).html($(this).html() == 'Edit' ? 'Save' : 'Edit');
  
              if('td[contenteditable=true]')) {
                      'td[contenteditable=false]');
              }
              else if('td[contenteditable=false]')){
                      'td[contenteditable=true]');
              }
              //else not editable row
             }); //moved this
          });
      &lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
    &lt;table id="tableone" border="1"&gt;
      &lt;thead&gt;
          &lt;tr&gt;&lt;th class="col1"&gt;Header 1&lt;/th&gt;&lt;th class="col2"&gt;Header 2&lt;/th&gt;&lt;th class="col3"&gt;Header 3&lt;/th&gt;&lt;th class="col3"&gt;Header 4&lt;/th&gt;&lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tr class="del"&gt;
          &lt;td contenteditable="false"&gt;Row 0 Column 0&lt;/td&gt; //changed to false after experiment
          &lt;td&gt;&lt;button class="editbtn"&gt;Edit&lt;/button&gt;&lt;/td&gt;
          &lt;td contenteditable="false"&gt;Row 0 Column 1&lt;/td&gt;
          &lt;td contenteditable="false"&gt;Row 0 Column 2&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr class="del"&gt;
          &lt;td contenteditable="false"&gt;Row 1 Column 0&lt;/td&gt;
          &lt;td&gt;&lt;button class="editbtn"&gt;Edit&lt;/button&gt;&lt;/td&gt;
          &lt;td contenteditable="false"&gt;Row 1 Column 1&lt;/td&gt;
          &lt;td contenteditable="false"&gt;Row 1 Column 2&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
      &lt;input id="btnHide" type="button" value="Hide Column 2"/&gt;
  
  &lt;/body&gt;
  </code></pre>