Riskbreaker Riskbreaker - 1 year ago 62
HTML Question

show div base on specific input text in multiple strings

Jquery question...So this is simple find the value if match from keyup show the button. But I want to ask for 2 questions to improve this:


$("#test").keyup(function () {
$("#yeah").css("display", this.value == "test" ? "block" : "none");

Where im stuck is:

= good

test here
= nothing

I want to keep the display no matter how the string is place as long as its placed it will not go away

So Ex:
I want to do some tests
- will show

And the other question is how do you do multiple strings? like if i want to show it on
and something like

Answer Source

Use a regular expression:

$("#test").keyup(function() {
#yeah {
  display: none;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<input id="test">
<div id="yeah">

This regexp matches anything with test or something in it.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download