title: Making A Pyperclip Button in Flask
body: <p>I'm building a web app right now that has a couple of text-fields that I would ideally like to be able to copy (individually) using a "copy" button next to each field. Right now I'm attempting to write a Pyperclip function in my main file, and then passing that as an <code>onclick</code> value for a button, but as soon as the page loads, the Pyperclip function executes and my clipboard is updated without pressing anything. So for example:</p>
  
  <pre><code>@app.route('/converted.html', methods = ['GET', 'POST'])
  def converted():
      pyperclip_Test = pyperclip.copy("apple")
  
      return render_template('converted.html', 
          pyperclip_Test = pyperclip_Test)
  </code></pre>
  
  <p>Then in my template file:</p>
  
  <pre><code>&lt;a href="#" onClick = "{{ pyperclip_Test }}; return false"&gt;Test&lt;/a&gt;
  &lt;div&gt;Data that I want to copy&lt;/div&gt;
  </code></pre>
  
  <p>I know the pyperclip function isn't copying that div - I retracted the original data that I can pass - but the problem still remains that the script executes without me pressing the button. </p>
  
  <p>Any idea on how to get this working?</p>