Skip to content

Instantly share code, notes, and snippets.

@MGCodeSnips
Created September 12, 2016 16:22
Show Gist options
  • Save MGCodeSnips/665528f6ff5f492cf91b983862f3e0c7 to your computer and use it in GitHub Desktop.
Save MGCodeSnips/665528f6ff5f492cf91b983862f3e0c7 to your computer and use it in GitHub Desktop.
you can use this to force the search to do an exact search
/* put this in the searchbox ekm tag */
<input type="checkbox" name="ticked" id="ticked" value="Bike"> tick it<br>
/* paste this in the footer */
<script type='text/javascript'>
$(document).ready(function()
{
$("form").submit(function(e)
{
var txtbox = document.getElementsByName("search")[0];
var tickbox = document.getElementById("ticked");
AddQoutes(txtbox, tickbox);
});
});
function AddQoutes(txtbox, tickbox)
{
if (tickbox.checked == true)
{
if (txtbox.value.charAt(0) != "\"")
txtbox.value = "\"" + txtbox.value
if (txtbox.value.charAt(txtbox.value.length - 1) != "\"")
txtbox .value += "\"";
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment