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
Post a Comment