0

我有一个带有一些选项的“选择”和一个 liveSearch 来搜索这些选项。如果我搜索一个不存在的选项,我会得到输出“No results match xy”。如何以编程方式检查我的搜索是否成功或是否得到此输出?

<body class="inventorypage" onload="selectM()">
.....
<form>
    <div class="form-row">
        <div class="col-lg-7">
            <div class="select_box">
                <select class="select4 col-md-12" single title="Auswählen" id="searchInput">
                    <option>Search1</option>
                    <option>Search2</option>                                                                                
                    <option>Search3</option>
                </select>                                                                                                                                                               
            </div>
        </div>
    </div>
    <div class="form-row">
        <div class="col-lg-7">
            <button type="button" onclick="searchM()" class="btn3 mt-2 mb-3">Search</button>
        </div>
    </div>
    <div class="form-row">
        <div>                           
            <p id='output'></p>
        </div>      
    </div>  
</form>
function selectM(){
    var eingabe = document.getElementById('searchInput');   
    $(document).ready(function(){
        $('.select4').selectpicker({
            liveSearch: true
            //,noneResultsText: 'I found no results'
         });
    })
}

function searchM(){
    //if("no results found"){
         //console.log("users search input");
    //}
}
4

0 回答 0