www.webdeveloper.com
Results 1 to 2 of 2

Thread: populate textfield from the input of another textfild

Hybrid View

  1. #1
    Join Date
    Dec 2002
    Location
    Warwickshire, England
    Posts
    182

    populate textfield from the input of another textfild

    Hi all,

    I would like to populate a testfield with the content of another textfield.

    Textfield 1, user input. on blur populate textfield 2 with the content of textfield 1.

    This is what I am working with:

    Code:
    function fill() {
       
       var a =document.getElementById("textfield1").value;
        
        document.getElementById("textfield2").value=a;
     }
    
    
    
    <input name="textfield1" type="text" class="roomno" id="textfield1" size="6" onblur="fill():" >
    
    <input name="textfield2" type="text" id="textfield2" size="6">
    For whatever reason this is not working. Can anyone see what I am doing wrong.

    Many thanks in advance.

    Dereck
    Keep safe and well.

    Dereck

  2. #2
    Join Date
    Jan 2010
    Posts
    79
    You had a colon in your onblur rather than a semicolon
    Code:
    onblur="fill()"
    And if it is just one line or one function call you don’t need semicolons to delineate the lines

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles