javascript - Filtering by Child Div not working -


i trying filter div elements looking @ id of child element, can't seem working , can't spot why.

the html:

<div class="section-link" id="section-tooltip">     <div class="brand tp" style="display: none;"></div>     contents </div>  <div class="section-link" id="section-tooltip">     <div class="brand garden" style="display: none;"></div>     contents </div> 

the js:

function brand(string){     var brand = string;     $('.section-link').hide();     if ($(".section-link").children('.brand').hasclass(brand)) {         $(this).parent().show();     } } 

i executing following via chrome browser: javascript:brand("tp");

it hides div's not show 1 tp element inside

$("this") wrong.

$(this) //this right 

edit. one: isn't

.hasclass() 

but

.hasclass() 

Comments