Button to clear all search boxes?

Feb 5, 2016 at 2:58 PM
I have been trying, and have a columncount I implemented but for the life of me I cannot create a button to simply clear all text boxes. Any help would be greatly appreciated.
<script src="http://www.google.com/jsapi"></script>

<script>

var columnCount = -1;

google.load("jquery", "1.2.6");

google.setOnLoadCallback(function() { 

$(document).ready(function()
{   
    jQuery.extend(jQuery.expr[':'], {
      containsIgnoreCase: "(a.textContent||a.innerText||jQuery(a).text()||'').toLowerCase().indexOf((m[3]||'').toLowerCase())>=0"
    });

    
    $("table.ms-listviewtable tr.ms-viewheadertr").each(function()
    {
        if($("td.ms-vh-group", this).size() > 0)
        {
            return; 
        }
        
        var tdset = "";
        
        var colIndex = 0;
        
        $(this).children("th,td").each(function()
        {
            if($(this).hasClass("ms-vh-icon"))
            {
                // attachment
                tdset += "<td></td>";
            }
            else
            {
                // filterable
                tdset += "<td><input type='text' class='vossers-filterfield' filtercolindex='" + colIndex + "' /></td>";                
            }
            
            colIndex++;
columnCount++;
        });
        
        var tr = "<tr class='vossers-filterrow'>" + tdset + "</tr>";
        
        $(tr).insertAfter(this);
    }); 
    
    
    $("input.vossers-filterfield")
        .css("border", "1px solid #7f9db9")
        .css("width", "100%")
        .css("margin", "2px")
        .css("padding", "2px")
        .keyup(function()
        {           
            var inputClosure = this;
            
            if(window.VossersFilterTimeoutHandle)
            {
                clearTimeout(window.VossersFilterTimeoutHandle);
            }
            
            window.VossersFilterTimeoutHandle = setTimeout(function()
            {
                var filterValues = new Array();
                
                $("input.vossers-filterfield", $(inputClosure).parents("tr:first")).each(function()
                {               
                    if($(this).val() != "")             
                    {
                        filterValues[$(this).attr("filtercolindex")] = $(this).val();
                    }
                });     
                
                            
                $(inputClosure).parents("tr.vossers-filterrow").nextAll("tr").each(function()
                {
                    var mismatch = false;
                    
                    $(this).children("td").each(function(colIndex)
                    {
                        if(mismatch) return;
                        
                        if(filterValues[colIndex])
                        {
                            var val = filterValues[colIndex];
                            
                            // replace double quote character with 2 instances of itself
                            val = val.replace(/"/g, String.fromCharCode(34) + String.fromCharCode(34));                         
                                                                                
                            if($(this).is(":not(:containsIgnoreCase('" + val + "'))"))
                            {
                                mismatch = true;
                            }                       
                        }
                    });
                    
                    if(mismatch)
                    {
                        $(this).hide();
                    }
                    else
                    {
                        $(this).show();
                    }       
                });             
                
            }, 250);
        });
});
//alert(columnCount);
});

</script>
Feb 7, 2016 at 7:05 PM
I basically created a submit button that caused a postback clearing the text boxes. That was the easiest solution.
Marked as answer by MethodDev on 2/7/2016 at 12:05 PM