the problem I am having is that the event handler isn't running when the user types on mobile devices browsers.
My javascript code working like this: When user write someting and press space javascript code automatically adding #(diez) tag for hashtag system. Like if you write: this is test message, javascript code change it like this: #this #is #test #message all after space.
If you check this DEMO on your computer browser (Chrome, Safari, Firefox, Opera) it is working fine.
But if you check this DEMO on your mobile browsers event handler isn't running when you types someting.
$("body").on("keypress","#text", function(e) {
var code = e.charCode || e.keyCode || e.which;
if (charactersX.has(code)) {
var text = $("#text").text();
text = addHashtags(text);
$("#text").text(text);
placeCaretAtEndX(document.querySelector("#text"));
console.log(text);
} else if (forbiddenCharactersX.has(code)) {
e.preventDefault();
console.log("something");
}
});
Full code is HERE.