quicksearch icon indicating copy to clipboard operation
quicksearch copied to clipboard

How to include another element into the quicksearch?

Open q2apro opened this issue 7 years ago • 1 comments

Let's assume we have something like:

<h2>Fruit</h2>
<ul>
    <li>Apple</li>
    <li>Pear</li>
    <li>Orange</li>
</ul>

<h2>Veggy</h2>
<ul>
    <li>Cucumber</li>
    <li>Tomato</li>
    <li>Minions</li>
</ul>

I'd use quicksearch on an input field like this (just example code including highlighting):

	// search
	$("input#search").quicksearch("ul li", {
		noResults: '#noresults',
		stripeRows: ['odd', 'even'],
		loader: 'span.loading',
		onBefore: function() { $("ul li").unhighlight(); }, // remove former highlighting
		onAfter: function() {
			if($('#id_search').val()!='' && $('#id_search').val().length>1) {
				$("ul li:visible").highlight( $('#search').val() );
			}
		},
	});

Question is: How can I include the h2 into the quicksearch?

The quicksearch only reads the li elements.

q2apro avatar Apr 11 '18 13:04 q2apro

$("input#search").quicksearch("ul li, h2", ... should do the trick ?

nitriques avatar Apr 13 '18 19:04 nitriques