We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5811
    • 1,717 Posts
    How difficult do you anticipate that it might be to debug the issue of "enter" causing a page refresh when using jQuery?
    I never don’t know how that it might to fix something, particularly when this is a browser issue.
    Nevertheless, find attached the fix. I have tested with Firefox 3.5, IE7 and Safari 5.0. Thanks to check that’s now ok.

    Unzip the file and save it in the ajaxSearch/js/ajaxSearch1/ directory

      • 13736
      • 345 Posts
      Well it seems to have caused them all to stop working (except Firefox). IE8 and Safari 5, and Chrome will not even search with the submit button or the "enter" key.

      What was the change that should have fixed it?
        • 5811
        • 1,717 Posts
        I did a mistake when I minified the js file. I forgot the variables:
        var _version='1.9.0';var _opacity=1.;var _liveSearch=0;var _minChars=3;var _init='none';var _pagingType=1;
        So, it can’t work. Hereafter a new release.

        The changes done are the following. I replace:
          if (as['si'].length) as['si'].keydown(function (e) { 
            var keyCode = e.keyCode || e.which;
            if (keyCode == 13) {
              doSearch(as);
            }
          });
        by
          if (as['si'].length) as['si'].keypress(function (e) {
            var keyCode = e.keyCode || e.which;
            if (keyCode == 13) {
              doSearch(as); 
              return false;
            }
          });
        keypress used instead of keydown. and return false added after the doSearch(as).
          • 13736
          • 345 Posts
          Well that seemed to fix it in my browser testing. Thank you. It’s interesting how Firefox didn’t seem to care which keyxxxx function was used while all the other browsers refused to work.


          As a future feature suggestion, I would like to be able to easily put the red X for clearing a search, inside the results window instead of next to the search box.
            • 5811
            • 1,717 Posts

            Issue registered as AJAXSEARCH-68

            Thanks Pixel Stuff for this feedback