[Solved] How to remove spaces using JavaScript? [duplicate]
[ad_1] You can use replace to replace spaces with nothing. var inputBox = document.getElementById(‘chatinput’); inputBox.onkeyup = function() { document.getElementById(‘printchatbox’).innerHTML = inputBox.value.replace(‘ ‘, ”); } <script src=”https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js”></script> <div class=”form-group”> <label>Title Page</label> <input type=”text” id=”chatinput” class=”form-control” required=””> </div> <div class=”form-group”> <div><b>Permalink: </b>http://doamin.com/<span id=”printchatbox” class=”cl-blue”></span></div> </div> NOTE: Upon seeing a suggested edit, I must remark that this is … Read more