Search for characters entered in the <JavaScript> input box and characters in h3

Asked 2 years ago, Updated 2 years ago, 83 views

<input type="search" name="search-mini" id="search-mini" value="" data-mini="true" />

<ul>
    <li><h3 class="text"> Hello</h3></li>
    <li><h3 class="text"> Thank you</h3></li>
</ul>

If the code is written like this, if you type "Hi" in the input box, I want to show you only the "Hello" part that contains the text "Hi".

Current JavaScript is

// input character import part
  var i = $('#search-mini').val();
// h3 Importing characters
  var j = $('.text').text();

That's all I've written.

javascript html web

2022-09-21 22:51

1 Answers

As someone recommended AngularJS in the comments, it's basically a part where you have to bind event. And you need conditions where the input actually matches the text reasonably.

Please note that I wrote demo under the premise of writing jQuery.


2022-09-21 22:51

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.