//JQuery:
//mobile - netbanking search
$(document).on('keyup', '#filter', function (e) {
// Retrieve the input field text and reset the count to zero
var filter = $(this).val();
//Regex created to find value in list.
var pattern = new RegExp(filter, "i");
// Loop through the comment list
$(".list").each(function () {
// If the list item does not contain the text phrase fade it out
//Trim space from variable value.
var str = $(this).text().trim();
if (str.search(pattern) < 0) {
$(this).fadeOut();
//Show the list item if the phrase matches and increase the count by 1
} else {
$(this).show();
}
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
JQuery Solution:
HTML will be:
<div class="yourlist">
<input name="" id="filter" type="text" placeholder="Search list" onkeyup="this.setAttribute('value', this.value);" value="">
<div class="list" style="display: block;">
Abc
</div>
<div class="list" style="display: block;">
xyz
</div>
<div class="list" style="display: block;">
qwe
</div>
</div>