title: How to close my modal with the key enter + onclick
body: <p>I have a modal that takes an input and display it on the screen, it works fine when I press the button "Save". But I'd like it to work when I press the key enter. I've found a few answers but it doesn't really suit my code as I want both the onClick and press enter. 
  I've also tried to change the button for a "submit" type but it doesn't work well.
  Is there a quick and simple way to do that with my current code ?</p>
  
  <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>    function addMovie() {
      
        var i = document.getElementById('addedMovie');
        var d = document.createElement('div');
        d.id = "new-movie";
        d.innerHTML = "&lt;p&gt;" + "&lt;img src='../images/movie.png'&gt;" + i.value + "&lt;/p&gt;";
        var p = document.getElementById('related-movies');
      
        p.appendChild(d);
      
      }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>      &lt;div class="modal-content"&gt;
            &lt;div class="modal-header"&gt;
              &lt;button type="button" class="close" data-dismiss="modal"&gt;&amp;times;&lt;/button&gt;
              &lt;h4 class="modal-title"&gt;Add a movie&lt;/h4&gt;
            &lt;/div&gt;
            &lt;div class="modal-body"&gt;
              &lt;input type="text" placeholder="Movie title" name="movies[]" class="modal-input" id="addedMovie"&gt;
            &lt;/div&gt;
            &lt;div class="modal-footer"&gt;
              &lt;button type="button" class="btn btn-login" data-dismiss="modal" onClick="addMovie();clearModal()"&gt;Save&lt;/button&gt;
            &lt;/div&gt;
          &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Or is there a simpler a way to do that (by submiting the input in the modal and display it on the div of my choice for example ? because at the moment I am just taking the value inside the input but I don't think I am saving it into a variable)</p>
  
  <p>Thanks a lot for your help !</p>