Highlight the div onclick and unhighlight second time click
<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>var a = document.getElementById('a');
var b = document.getElementById('b');
b.style.cursor = 'pointer';
a.style.cursor = 'pointer';
a.onclick = function() {
  $("#a").css("background-color", "red");
};
b.onclick = function() {
  $("#b").css("background-color", "yellow");
};</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
&lt;div class="a" id="a"&gt;
  Logesh Logesh Logesh Logesh Logesh Logesh Logesh Logesh Logesh Logesh Logesh Logesh Logesh
&lt;/div&gt;
&lt;br&gt;
&lt;div class="b" id="b"&gt;
  Logesh Logesh Logesh Logesh Logesh Logesh Logesh Logesh Logesh Logesh Logesh Logesh Logesh
&lt;/div&gt;
&lt;br&gt;
&lt;div class="b" id="b"&gt;
  Logesh Logesh Logesh Logesh Logesh Logesh Logesh Logesh Logesh Logesh Logesh Logesh Logesh
&lt;/div&gt;</code></pre>
</div>
</div>
</p>

<p>I want to add background-color css to the div i click and again clicking on the same dive it should remove the BG color.</p>

<p>Here i wrote the code as getting id statically. I may get many div in future so i need to get the div id dynamically. like something $this.id bla bla... please help me. Thank u..</p>