I need to give condition between english keyboard layout and japanese keyboard layout using jquery

22 Views Asked by At

The following code condition is Japanese keyboard keycode and If I change English keyboard layout it needs to work.

$('input,textarea,div#editorId').on('keydown', function(e) {
  if ((e.shiftKey == false && e.keyCode == 220) || (e.shiftKey == false && e.keyCode == 226)) {
    Swal.fire({
      type: "info",
      html: "BackSlash is not allowed",
      confirmButtonClass: "btn btn-success"
    })
  } else if ((e.shiftKey == true && e.keyCode == 192) || (e.shiftKey == true && e.keyCode == 50) || (e.shiftKey == true && e.keyCode == 55)) {
    Swal.fire({
      type: "info",
      html: "Double and Single Quotes are not allowed",
      confirmButtonClass: "btn btn-success"
    })

  } else if (e.shiftKey == false && e.keyCode == 188) {
    Swal.fire({
      type: "info",
      html: "Comma is not allowed",
      confirmButtonClass: "btn btn-success"
    })
  }
});
0

There are 0 best solutions below