I am trying to implement a javascript on my page and I want to refer to a function with the onclick property. How would I do this, how would I change my following code so that is actually runs the script correctly?
$(document).ready(function()
{
function dosomething()
{
alert('I just did something');
}
});
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<input type="button" class="btn btn-default" value="Kortingscode" onclick="dosomething()">
Thanks in advance.
$(document).readyin this case. The code within doesn't need the document for anything.