Solved

Clicking a button When the Enter key is pressed on a particular textbox

  • 5 October 2018
  • 2 replies
  • 20 views

I have a textbox used to search a list view.  However by default hitting Enter on a textbox does nothing.

I need to click an existing button when people hit enter while on that search textbox.
I tried this JS

<script> $('[name="Search Box"]').keyup(function(event) { if (event.keyCode == 13) { $('[name="Refresh"]').click(); } }); </script>

("Search Box" being the name of the textbox, and Refresh being the name of the button, however I have tried it several times and the button does not get clicked when I hit enter. I have also tried .keypress instead of .keyup and neither work. The Data label is set to literal)

 

I know this has been asked before but the above was the solution, and it is not working for me.
Running K2 4.7

Thanks

icon

Best answer by davidedpg10 5 October 2018, 19:49

View original

2 replies

Yes, The datalabel is literal and not visible.

It is not executing though, or at least not clicking the button when I hit enter while typing in the textbox.
I have no idea why. It should work.

My bad, it was the button name that was wrong..
It was "Refresh_Button" not "Refresh"

Reply