title: Select single table row from bootstrap table
body: <p>I need to be able to select a row in a table by clicking it (and using css class for highlight styling)</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$("#infoTable tr").click(function() {
    var selected = $(this).hasClass("highlight");
    $("#infoTable tr").removeClass("highlight");
    if (!selected)
      $(this).addClass("highlight");
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" /&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;div class="container"&gt;
    &lt;table id="infoTable" class="table table-fixed"&gt;
      &lt;thead&gt;
        &lt;tr&gt;
          &lt;th class="col-xs-3"&gt;Name&lt;/th&gt;
          &lt;th class="col-xs-3"&gt;Age&lt;/th&gt;
          &lt;th class="col-xs-6"&gt;Occupation&lt;/th&gt;
          &lt;th class="col-xs-6"&gt;Salary&lt;/th&gt;
        &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr class="clickableRow"&gt;
          &lt;td class="col-xs-3"&gt;John&lt;/td&gt;
          &lt;td class="col-xs-3"&gt;43&lt;/td&gt;
          &lt;td class="col-xs-6"&gt;School Teacher&lt;/td&gt;
          &lt;td class="col-xs-6"&gt;$43,000&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr class="clickableRow"&gt;
          &lt;td class="col-xs-3"&gt;Tim&lt;/td&gt;
          &lt;td class="col-xs-3"&gt;52&lt;/td&gt;
          &lt;td class="col-xs-6"&gt;Plumber&lt;/td&gt;
          &lt;td class="col-xs-6"&gt;$55,000&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>my files:</p>
  
  <pre><code>        &lt;link rel="stylesheet" href="main.css"&gt;
          &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"&gt;
          &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"&gt;&lt;/script&gt;
          &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"&gt;&lt;/script&gt;
          &lt;script src="main.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>but it does nothing. Any help is appreciated, Thank You!</p>