Created
September 12, 2016 16:22
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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