I have read posts from September 2014 explaining how to add a site search box but when I test it, my search results are not limited to my site. I copied the placeholder body code and head code given and edited it for my site as follows:

<script type="text/javascript">
//Enter domain of site to search.
var domain="www.wonershhistory.co.uk" //replace this with your site domain

function GoogleSiteSearch(cur){
cur.q.value="site:"+domain+" "+cur.searchTerm.value
}
</script>

<form action="http://www.google.com/search" method="get" target="_blank" onSubmit="GoogleSiteSearch(this)">
<p>Search www.wonershhistory.co.uk:<br /> <!--replace [[...]] with your details -->
<input id="searchBox" name="searchTerm" type="text" style="width: 200px" />*<input type="submit" value="Search" /></p>
<input name="q" type="hidden" />

I think the problem might be in the third line from the end. I have tried including one set/two sets of [] brackets and also quotes "".

I would be grateful if someone could show me where I have gone wrong.