Thank you for your help.
Is there anyone who implemented the list of input search history in monaca like the image below?
Or how about this method?I would appreciate it if you could share it with me.
I think using HTML5 Suggest is the best shortcut.
// Search history array
var history_list = [ ];
function fake_search(){
// Retrieve and clear search terms
varsword=$("#s_words").val();
$("#s_words").val("";
// Add if not already registered
if(0>$.inArray(sword, history_list)){
// Add history to Suggest
$("#search_history").append($("<option>").val(sword));
// Add to word list
history_list.push(sword);
}
alert("Pseudosearched.\n Added words and phrases to search history.");
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="search" id="s_words" name="s_words"placeholder="Please enter a search term." list="search_history"/>
<button onclick="fake_search();">Search</button>
<datalist id="search_history">
</datalist>
*The above example uses jQuery to make it easier.
© 2024 OneMinuteCode. All rights reserved.