JavaScript Search Wildcard


I’m using the JS below on a SharePoint 2013 On-Prem custom list to add search functionality. It works fine but it has a serious limitation. It will only yield results on a string if the search is an exact match. For example, if I were to search the “Vendor” field below with “Dell” then records with, for example, “Dell Inc.” wouldn’t display so I was wondering how to modify this code so that it would accept wildcards or just automatically search the string if it contains any part of the text being searched for?


<script type="text/javascript">

	function Search() {
		var st = document.getElementById("Searchtext").value;
		var cd = document.getElementById("coldropdown").value;
		var url = "";
		if(st !="") {
			if(cd == "ID" || cd == "Title" || cd =="Author" || cd == "Vendor") {
				url = "FilterField1=" + cd + "&FilterValue1=" + st;
				window.location.href = "AllItems.aspx?" + url;
			else {
				url = "FilterName=" + cd + "&FilterMultiValue=*" + st + "*";
				window.location.href = "AllItems.aspx?" + url;
		else {
			return false;
	function Clear() {
		window.location.href = "AllItems.aspx";
	Search Field: <select id="coldropdown">
	<option value="ID">ID</option>
	<option value="Title">Title</option>	
	<option value="Author">Created by</option>
	<option value="Vendor">Vendor</option>
	Search text: <input id="Searchtext" type="text"/>
	<input id="btnSearch" onclick="return Search();" type="button" value="Search"/>
	<input id="btnSearch" onclick="return Clear();" type="button" value="Clear"/>