开发者

How do I perform a div search in jquery?

开发者 https://www.devze.com 2023-03-19 03:29 出处:网络
my code- $(\"#search\").keyup(function(){ var $search = $(\"#search\"); $(\"#l\").find( $search ).css(\'color开发者_如何学JAVA\',\'red\');

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消