How to remove empty space form Input box Javascript

How to remove empty space form Input box using Javascript

 

<input id=”inp”>

 


<input id="inp" type="text" />

<script language="JavaScript">
function emtyspace(){
var x = document.getElementById("inp");
this.value = x.value.toLowerCase().split(' ').join('');
}

document.getElementById("inp").addEventListener("click", emtyspace);
</script>

 

Leave a Reply

Your email address will not be published. Required fields are marked *