i have in my asp.net page a textarea where users type an article="long text" to be saved in the database. In another page i display these articles(textarea) in a :
<p clas开发者_运维问答s="p-article">
the text of the article goes here.
</p>
I'd like to filter these articles by search keywords .for example when a user search for "Startup Marketing".
I want to apply the keywords as a filter and get articles and bring those that contain "Startup" or "Marketing" or "Startup Marketinbg".And this in client side by jquery if possible.
This may help
var keyword = $("#searchtextbox").val().split(' ');
$.each(keyword,function(){
$(".p-article").html(function(index,oldhtml){
return oldhtml.replace(keyword,"<span style='background-color:Yellow'>"+keyword+"</span>");
});
});
精彩评论