I'm in a hurry to ignore javascript case lettersIf there is a web god, please help me(Crying)

Asked 2 years ago, Updated 2 years ago, 45 views

<li><a><img src="img/location/airport.png"><<h3> Where is the airport?</h3><h3>Where is the airport?</h3></a></li>
$(document).ready(function () {
    $("#search-mini").keyup(function () {

      var k = $(this).val();

      $(".content > ul > li > a").hide();

      var temp = $(".content > ul > li > a > h3:contains('" + k + "')");

      $(temp).parent().show();
    });
 });

When searching for the sentence "Where is the air?" in the HTML # h3 tag, I want to make it appear even if I type "where", so please tell me how to ignore case-sensitive charactersㅜ <

javascript jquery

2022-09-22 18:49

1 Answers

I'll replace it with the answers that come out when I google it.

You can expand the expression of the selector in jQuery.

https://jsfiddle.net/bipen/dyfRa/

This example is based on jQuery 1.9.1 and

The default expr object has been expanded to make it available for other keywords (containsIN).

For case sensitive, all strings (textContent/innerText) were converted to lowercase and compared.


2022-09-22 18:49

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.