开发者

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?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜