ats2012
asked on
Display text on website using a textbox with jQuery
I have some code where you type some text in a textbox and it will display under it. What i would like is instead of using keypress I am looking for it copying the text box so right now when you back space it wont delete it until you press another key. Is this possible? Below is the code I am using.
<!DOCTYPE html>
<html>
<head>
<script src="jquery.js" language="javascript" type="text/javascript"></script>
<title>Display text</title>
</head>
<body>
<input type="text" value="" id="box"/>
<div id="div_one"></div>
<script>
$("#box").keypress(function() {
var $this= $(this);
window.setTimeout(function() {
$("#div_one").text($this.val());
}, 0);
});
</script>
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
There a fix for Internet Explorer? It works great in Chrome but all my users will be using IE.
ASKER
Nevermind I got it working
ASKER