Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
168
rated 0 times [  169] [ 1]  / answers: 1 / hits: 35279  / 12 Years ago, mon, december 10, 2012, 12:00:00

Respected Members,



I am designing the website in pure HTML with the help of one Template.



In that i have one textbox[search] and Go button.



I want to make operation such that when any one types certain text and presses Go button,
It should highlight the text in that website which is matching to that text.



How can i do that?



Than You.


More From » html

 Answers
13
$(document).ready(function(){
$('#searchItem').keyup(function(){
var name = $(this).val();
var pattern = name.toLowerCase();
var targetId = ;
var divs = document.getElementsByClassName(item);

$(document).find('.item').hide();

$('.item').each(function(i){
var para = divs[i].getElementsByTagName(p);
var index = para[0].innerText.toLowerCase().indexOf(pattern);
if (index != -1) {
$(this).show();
}
});
});
});

[#81511] Friday, December 7, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
darrell

Total Points: 109
Total Questions: 113
Total Answers: 113

Location: Zambia
Member since Sat, Oct 31, 2020
4 Years ago
darrell questions
Mon, May 9, 22, 00:00, 2 Years ago
Sat, Mar 19, 22, 00:00, 2 Years ago
Sat, Oct 10, 20, 00:00, 4 Years ago
;