Guide Search On Enter Key Disable Function

2 Kommentare

  • Greg Katechis
    Zendesk Developer Advocacy

    Hi Ash, sorry for the delay in response. I was looking at this last week and it seems that there is something with the way that we render the search button within our templating language that somehow overrides `preventDefault` or any other variants where we try to interrupt the action from taking place. 

    I haven't done any testing with this yet, but you could try to hide the enter button by default and then show it when there is text in that input field. 

  • Ash

    For anyone that needs the code, this worked for us:

     $(document).ready(function() {
      document.addEventListener('keydown', (e)=>{
        if (e.which == 13 && == "query") {
          //do something
      }, true)

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.

Powered by Zendesk