JSFiddle - React, Tailwind, and code Playground

by RenatoRamosPuma

HTML

<h1>Replace whitespace by «-» Not workin in input type email</h1>
<input type="text" class="demo" placeholder="type=text" /><br /><br />
<input type="email" class="demo" placeholder="type=email" />

JavaScript

$(document).on("keyup",".demo",function(e) {
			
			
	$(this).val($(this).val().replace(/\s+$/g, "-"));
  
});