javascript function and html onclick property
<p>I am trying to implement a javascript on my page and I want to refer to a function with the <code>onclick</code> property. How would I do this, how would I change my following code so that is actually runs the script correctly?</p>

<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function()
{
 function dosomething()
  {
   alert('I just did something');
  }
  
});</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/&gt;
&lt;input type="button" class="btn btn-default" value="Kortingscode" onclick="dosomething()"&gt;</code></pre>
</div>
</div>
</p>

<p>Thanks in advance.</p>