title: Javascript/Laravel only First ID works for button
body: <p>I am using laravel and am looping to display all my users with an edit button. I want to hide the user edit form with javascript and have it appear on click. This works for the first item in my array, but when I try to edit a second user, the button won't work. Is there a way to insert an id into the form directly with laravel? I know it's because id is being reiterated, but all I'm not sure how to fix that.</p>
  
  <p>users.index</p>
  
  <pre><code>@extends('layouts.admin')
  
  
  @section('content')
  
  
  
  &lt;div class="col-sm-8"&gt;
      &lt;div class="panel"&gt;
  
  
          @if($users)
          @foreach($users as $user)
  
          &lt;p&gt;{!! $user-&gt;name !!}&lt;/p&gt;
          &lt;button class="btn btn-primary" id="edit-user"&gt; Edit&lt;/button&gt;
          &lt;hr&gt;
          &lt;div class="edit-user"&gt;
          &lt;h1&gt;Edit Users&lt;/h1&gt;
  
              {!! Form::open(['method'=&gt;'POST', 'action'=&gt;'AccountController@store']) !!}
  
                  &lt;div class="form-group"&gt;
                      {!! Form::label('name', 'Client Name:') !!}
                      {!! Form::text('name', null, ['class'=&gt;'form-control']) !!}
                  &lt;/div&gt;
                      {{ csrf_field() }}
  
                  &lt;div class="form-group"&gt;
                      {!! Form::label('start_access_date', 'start:') !!}
                      {!! Form::text('start_access_date', null, ['class'=&gt;'form-control']) !!}
                  &lt;/div&gt;
                      {{ csrf_field() }}
  
  
                      &lt;div class="form-group"&gt;
                      {!! Form::label('end_access_date', 'end:') !!}
                      {!! Form::text('end_access_date', null, ['class'=&gt;'form-control']) !!}
                  &lt;/div&gt;
                      {{ csrf_field() }}
  
  
                      {{ csrf_field() }}
                  &lt;div class="form-group"&gt;
                      {!! Form::submit('Edit Account', ['class'=&gt;'btn btn-primary']) !!}
                  &lt;/div&gt;
  
              {!! Form::close() !!}
  
  
          &lt;/div&gt;
   @endforeach
          @endif
  
  
  
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;script type="text/javascript"&gt;
  
      $('.date').datepicker({  
  
         format: 'mm-dd-yyyy'
  
       });  
  
  &lt;/script&gt;  
    &lt;script&gt;
  
      $(document).ready(function(){
  
  //if you wish to keep both the divs hidden by default then dont forget to hide //them           
  $(".edit-user").hide();
  
  
  
  $("#edit-user").click(function(){
        $(".edit-user").toggle();
  
  });
  
  });
  
  
  
  &lt;/script&gt;
      @endsection
  </code></pre>