[Solved] Trouble using your code to disable the enter key during the survey

0

I am trying to include this code in the survey theme for the purpose of disabling the return key.

I got the code from this website but can’t get it to work. Full disclaimer I am not a coder and have no idea what the below code does. So I  may have missed a syntax , although I checked it a few times.

<script>
$(document).ready(function(){
   $(“form :input:not(textarea)”).on(“keypress”, function(e) {
      return e.keyCode != 13;
});
$(“form :input:not(textarea)”).on(“keydown”, function(e) {
   return e.keyCode != 13;
});
});
</script>

 

Any help you can give me would be appreciated.

amy_aha answered

    Best answer

    1

    Hi Thomas,

    In that script it looks like it is only disabling the enter key if they are in a text area.

    I tested this on one page of my survey and it seemed to work for me. Give it a try.

    You will have to add this Action to every page you would like for this to take place.

    Create a Javascript – Action with the following code in it-

    $(‘html’).bind(‘keypress’, function(e)
    {
    if(e.keyCode == 13)
    {
    return false;
    }
    });

    Jacob Hayslett answered
      0

      I’m having trouble with both of these codes. Enter still advances the survey.

      amy_aha commented
        • Joshua in support helped me with this yesterday. Turns out you need to have the desktop interaction mode (in Style) set to standard. If it’s set as one at a time the javascript will not work.

        ×

        Login

        Question stats

        • Active
        • Views1224 times
        • Answers2 answers
        • Followers0 followers