简体   繁体   中英

jquery form submission button not working on mobile / touchscreens

Form submit button not working on mobile / touchscreen devices, it works on laptops but on mobile devices nothing happens, code below:

  $('[data-behavior="publish-button"]').on('click', function() {
    $('.editor-form').submit();
  });

  $('.publish-dropdown').on('click', function(e) {
  e.stopPropagation();
  });
},

You can try the following code:-

$('[data-behavior="publish-button"]').on('click touchstart', function() {
  $('.editor-form').submit();
});

$('.publish-dropdown').on('click touchstart', function(e) {
  e.stopPropagation();
});

If the element you are trying to touch does not have a pointer as the cursor (which is what I assume), it will not be touchable on iOS Safari.

Set cursor: pointer; and it will work as expected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM