I want to run a script that will be checking if there is a white space and tap space with javascript. Please I need a help.
This is my code:
var textinputs = document.querySelector("#message");
textinputs.addEventListener("keyup", e => {
if (/\s/.test(e)) {
$(btnSubmit).css("opacity", ".5");
$(btnSubmit).attr("disabled", "disabled");
console.log("block")
} else {
console.log("send");
$(btnSubmit).css("opacity", "");
$(btnSubmit).removeAttr("disabled");
}
});
My idea is to check if there is some white space or tap space if not enable the submit button