How do I perform a div search in jquery?
my code-
$("#search").keyup(function(){
var $search = $("#search");
$("#l").find( $search ).css('color开发者_如何学JAVA','red');
});
$("#l") is the div I want to search in.
$("#search").keyup(function(){
var $search = $("#search");
$("#l").children().find('#'+$search.val()).css('color','red');
});
$("#search").keyup(function(){
var searchTerm = "Hello";
$("#l:contains('+ searchTerm +')").css('color','red');
});
Just use :contains('value')
selector http://api.jquery.com/contains-selector/#text
Find text string using jQuery?
精彩评论