Jump to content

brendoop

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by brendoop

  1. The trouble is when a user hits Enter, it is the same as submitting the form it reloads the page, it won't get a chance to focus on 'myText' element

    The understood , thanks

  2. //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);
    }
×
×
  • Create New...