Share:

Create Simple Custom TextBox in HTML | Saatody | Amit Padhiyar



<div id="textbox" contenteditable="true">This is a paragraph. It is editable. Try to change this text.</div>

<script>
var textbox = document.getElementById("textbox");
textbox.addEventListener("keydown",function(event){
	if(event.keyCode == 13){
    	var enterChar = String.fromCharCode(13);
        var regExp = new RegExp(enterChar,"g");
    	textbox.innerHTML = textbox.textContent.replace(regExp,"");
    }
});
</script>


Comments

Popular posts from this blog

Get Color From Pixel C# WPF | Saatody | Amit Padhiyar

Basic Audio Operations With MP3 And Wave Files Using NAudio C#

Create Drag And Drop Operation Between DevExpress GridControl And Custom WPF UI | Saatody | Amit Padhiyar