Copy password to clipboard in Django app

Just finished the Password Generator, and was wondering how you would copy the password to the clipboard like you see a lot of sites do with a small copy button?

think the easiest solution is to use jQuery. really simple solution. all we need is to to add some scripts and and a few changes in html template password.html:

<link rel="stylesheet" href="" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<!-- load jQuery -->
<script src=""></script>
<div class="container text-center">
  <h1>Your password is:</h1>
  <h2 id="password_to_copy" class="alert alert-success">{‌{ password }}</h2>
  <a href="{% url 'home' %}" class="btn btn-info">Home</a>
  <button id="copyButton" onclick="copyToClipboard('#password_to_copy')" class="btn btn-info">Copy password to clipboard</button>
        function copyToClipboard (element) {
            // create input to handle password copy. we are going to
            // use jQuery select() which trigger selection of text in input
            let $temp = $("<input>");
            // append our temporary input to the document
            // set new value for temp input (we get value from <h2> tag with id password_to_copy)
            // and select it
            try {
              // copy to clipboard selected text and display success msg
              alert("Password: " + $(element).text() + " copied to clipboard");
            } catch (err) {
              // display error msg
              alert("Oops, unable to copy!!! Error: " + err);
            // remove temporary input