JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" class="chars_space_dots_apostrophes_only">

JavaScript

$(".chars_space_dots_apostrophes_only").bind('keypress', function (event) {
		    // http://stackoverflow.com/a/8833854/260665
		    var eventCode = event.which;
		    if((eventCode >= 37 && eventCode <= 40) ||  eventCode == 8 || eventCode == 9 || eventCode == 46) { // Left  / Right Arrow, Backspace, Delete keys
		        return;
		    }
		    // http://stackoverflow.com/a/8833854/260665
		    var regex = new RegExp("^[a-zA-Z '.]+$");
		    var key = String.fromCharCode(eventCode); // For some strange reason, the test does not pass for apostrophes and dots
		    if (!regex.test(key)) {
		        event.preventDefault();
		        return false;
		    }
		});