Jump to content

Caret position


brendoop
 Share

Recommended Posts

//Hi , As I because my function is not working. I want you to press Enter, Caret back pro start
<p>What is your name?</p>
<textarea id=myText onkeypress="Enter(event)"></textarea>
<script>
function Enter(event) {
var x = document.getElementById("myText").value;
b = document.getElementById("myText");
if ((x=="Brendo") && (event.keyCode==13)) {
document.getElementById("myText").value="";
b.focus();
b.setSelectionRange (0,0);
}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...