2013-05-08 4 views
1

입력과 일치하지 않는 페이지에서 타일을 제거하는 "필터링 입력 필드"를 만들려고합니다. 지금까지이있다input : text를 #id로 참조 할 수 있습니까?

...

HTML -

<input name="filter" type="text" value="Find who you're looking for" /> 
<a href='#' id='b_submit'>Submit</a> 

<article id='JohnS'>Content</article> 
<article id='BobG'>Content</article> 
<article id='SamL'>Content</article> 
<article id='RonaldY'>Content</article> 

스크립트 -

$("#b_submit").click(function() { 

    var filter_text = $('input:text').val(); 
    //this sets filter_text as the input value 

    $('article:not(??not sue what to call here??)').fadeOut(); 
    //this is where I need help, I need to call the value as an #id to eliminate non-matching articles. 

    }); 

이 작업을 수행 할 수있는 적절한 구문은 무엇입니까? 나는 단순한 필터링을 복잡하게하는 것 이상의 것입니까? 도움? : D

답변

3

이 밖으로 시도 :

$('article:not(:contains("' + filter_text + '"))').fadeOut(); 
+0

필터 텍스트와 일치하는 기사가 페이드 아웃되지 않습니까? – tymeJV

+0

@ tymeJV oops. 1 초 – Neal

+0

나는 그것을 고쳤다 :-). – Neal

관련 문제