title: How to call a jquery function since html?
body: <p>Good afternoon ! </p>
  
  <p>I have a simple problem , I have this code that works correctly.</p>
  
  <pre><code>&lt;a onclick='flotante(1)' data-auction="+data.subastas[i].id+" class='tester btn btn-default col-md-12'&gt;Pujar&lt;/a&gt;
  </code></pre>
  
  <p>This code return the id of subasta , then I am using Laravel and PHP , when the user is log and click on Auction , I need to call a jquery function.</p>
  
  <p>I have the following code</p>
  
  <p>@if(Auth::user())
      AA
  @else
      
              
                  Inicio de sesión   </p>
  
  <pre><code>             &lt;div class="row "&gt;
                      &lt;div class="col-md-6"&gt;
                          &lt;label for="email"&gt;Email&lt;/label&gt;
                      &lt;/div&gt;
                      &lt;div class="col-md-6"&gt;
                          &lt;input type="email" name="email" class="form-control margeninput"/&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                   &lt;div class="row "&gt;
                      &lt;div class="col-md-6"&gt;
                      &lt;label for="password"&gt;Password&lt;/label&gt;
                      &lt;/div&gt;
                      &lt;div class="col-md-6"&gt;
                      &lt;input type="password" name="password" class="form-control margeninput"/&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;                  
                  &lt;div class="row "&gt;
                  &lt;input type="submit" id="singlebutton" class=" col-md-6 col-md-offset-3 " name="singlebutton" style="margin-bottom:5px;"&gt;&lt;/input&gt; 
                  &lt;/div&gt;
          &lt;/fieldset&gt;
          &lt;input type="hidden" name="_token" value="{{ csrf_token() }}"&gt; 
      &lt;/form&gt;
       @foreach ($errors-&gt;all() as $error)
      &lt;div class="bderrors"&gt;
      &lt;p class="span-error"&gt;{{ $error }}&lt;/p&gt;
       &lt;/div&gt;
       @endforeach
  </code></pre>
  
  <p>@endif</p>
  
  <p>However I try to use this </p>
  
  <pre><code>@if(Auth::user())
      &lt;script type="text/javascript"&gt;
          alert("OK");
      &lt;/script&gt;
  @else
  </code></pre>
  
  <p>This code works when the user is login but not when user has doing click in auction.</p>
  
  <p>Could anyone help to me?</p>