How can I enhance this Jquery code to display a button when the input value matches a certain string on keyup event? I have two questions regarding this:
$("#test").keyup(function () {
$("#yeah").css("display", this.value == "test" ? "block" : "none");
});
The issue I'm facing is:
Type test
= good
Type test here
= nothing
I want the display to remain visible regardless of how the string is placed, as long as it contains the specified word.
For example: I want to do some tests
- should still show the button
Also, how can I make it work for multiple strings? For instance, displaying the button for test1
and test2
?