• Resolved Sakke123

    (@mejate)


    How can disable search when box is empty? It shows all my posts when nothing is written to bar

Viewing 1 replies (of 1 total)
  • Plugin Author Damian Góra

    (@damian-gora)

    Hi,

    You can try to disable ENTER key when the search field is empty. Following code does it.

    
    jQuery('.dgwt-wcas-search-form').on('keyup keypress', function (e) {
        var keyCode = e.keyCode || e.which;
        var value = jQuery(e.target).val();
        if (keyCode === 13 && value.length == 0) {
            e.preventDefault();
            return false;
        }
    });
    

    Best
    Damian

Viewing 1 replies (of 1 total)
  • The topic ‘disable empty search’ is closed to new replies.