I have a search box with two tabs to choose which type to search. I want to add .active class to list item whose search_type equals to a params from a request (i.e., params[request_type]).
<ul data-tabs="tabs" class="tabs">
<li search_type="Things">
<a href="#Things">Things</a>
</li>
<li search_type="People">
<a href="#People">People</a>
</li>
</ul>
I tried to compare in jQuery:
$('.tabs .li).(function(){
if($(this).search_type == myParams){
$(this).addClass('.active');
}
});
However, my $(this).search_type turns out to be undefined, even though in web-browser, the element shows up correctly as:
<li search_type="Things">
<a href="#Things">Things</a>
</li>
My question is: how to I get search_type from li?
Thank you.