Filter "list" divs with Javascript

I have a repeater that outputs divs as follows for each element returned by some method.

<div class="editor-area">
    <div class="title">the title</div>
    <div>the description</div>
    <div class="bottom-bar">
        <a href="link">Modify</a>
        <a href="link2">Delete</a>
    </div>
</div>

I need to have a text box on the page that allows the user to filter the list depending on what is in the title box. I would like this to happen as a user.

I could do it without help, but I want to do it right. I am using ASP.Net 2.0 WebForms (unfortunately) and I can use jQuery if it were useful for this (I have very little experience with it).

Any tips or samples will be appreciated.

If the filter operation takes a couple of seconds, how do you keep it from locking the screen? What event should the filter be enabled on? Is there anything in jQuery that will make javascript a bit cleaner?

+3
2

, jQuery. :

$("div.title").hide();

( "div" "title".) :

$("div.title:contains(searchText)").show();

"" .

"", . onKeyDown onChange.

+8

. ".parent()" ".hide()" ".show()", div.

, , , . - , .

+3

Source: https://habr.com/ru/post/1697992/


All Articles