title: How to change a variable value with onclick?
body: <p>I have a variable in my view which I want it's value to change according to a button I press. I tried this but It doesn't work:</p>
  <pre><code>&lt;button type=&quot;button&quot; data-dismiss=&quot;modal&quot; onclick=&quot;{{ $product1 = $p-&gt;id }}&quot; class=&quot;btn btn-primary&quot;&gt;Pick&lt;/button&gt;
  </code></pre>
  <p>This is inside a @foreach. Is there a way to have the $product1 variable change it's value with the button click? Preferably pure HTML or Laravel. If not, then how do I do it? Javascript?</p>