title: Passing data in modal with laravel
body: <p>I'm trying to pass data to a modal in laravel. I've created the foreach and modal in blade and the jQuery in a separate file. The modal opens but it doesn't pass the data through. I think my error is in jQuery.</p>
  
  <p><strong>Blade code</strong> </p>
  
  <pre><code>@foreach($course-&gt;activeLessons as $lesson)
      &lt;article class="lesson" &gt;
      {!! $loop-&gt;iteration!!}.  &lt;a href="{{route('learn.show', $lesson-&gt;id)}}"&gt;&lt;/a&gt;
          &lt;div class="body" id="title"&gt; {!! $lesson-&gt;title!!}&lt;/div&gt;
          &lt;p&gt; {!! $lesson-&gt;short_description !!}&lt;/p&gt;
          &lt;div class ="interaction"&gt;
              &lt;button type="button" class="btn btn-primary" mytitle={{$lesson-&gt;title}} data-target="#show" data-toggle="modal"&gt;
                  Start Lesson
              &lt;/button&gt;
           &lt;/div&gt;
      &lt;/article&gt;
  @endforeach
  
  &lt;div class="modal fade" id="show" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"&gt;
      &lt;div class="modal-dialog" role="document"&gt;
          &lt;div class="modal-content"&gt;
              &lt;div class="modal-header"&gt;
                  &lt;h5 class="modal-title" id="title"&gt;&lt;/h5&gt;
                  &lt;button type="button" class="close" data-dismiss="modal" aria-label="Close"&gt;
                      &lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;
                  &lt;/button&gt;
              &lt;/div&gt;
              &lt;div class="modal-body"&gt;
              &lt;/div&gt;
              &lt;div class="modal-footer"&gt;
                  &lt;button type="button" class="btn btn-secondary" data-dismiss="modal"&gt;Close&lt;/button&gt;
                  &lt;button type="button" class="btn btn-primary"&gt;Send message&lt;/button&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>jQuery Code</strong> </p>
  
  <pre><code>$('#show').on('show.bs.modal', function (event) {
      var button =(event.relatedTarget)
      var title = button.data('mytitle')
      var modal = $(this)
      modal.find('.modal-title, #title').val(title)
  });
  </code></pre>