Skip to content

How to include another element into the quicksearch? #82

@q2apro

Description

@q2apro

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions