Showing/Hiding a div depending on text input

Hello, im very new and trying to hide/show some divs depending on user input on a textbox. Here is the UI:
image

name of textbox - inp_hide_search
condition of textbox on showing first name div - inp_hide_search.value.contains(‘f’)+inp_hide_search.value.contains(‘i’)

Example scenario:

  • user will input f or i and it will show the first name div
  • but when im changing the condition to inp_hide_search.value.contains(‘first’), it does not show if i enter only f or i or r or s or t. I’m thinking to change it to an array but contains only accepts Text types
  • it will work fully if i change to this condition : inp_hide_search.value.contains(‘f’)+inp_hide_search.value.contains(‘i’)+inp_hide_search.value.contains(‘r’)+inp_hide_search.value.contains(‘s’)+inp_hide_search.value.contains(‘t’)
  • but it is too long and not a good practice, is there anyway to compress this?

Thanks!

This is not a valid condition you are using plus sign instead && for logical and.

So use && for local and or || for logical or

Hi, i mean what im trying to say is the condition on the dmx-show

Your condition expression is not correct.

You should use either || (logical OR) or && (logical AND) for your expression.

Maybe if you explain in a more clear way what is the exact condition you want to check it would be easier for us to answer your question.

Yeah i tried using || and it works also thanks @Teodor and @George

but my concern here is how to make this condition shorter? It looks like its hardcoded condition. Thanks!