www.webdeveloper.com
Results 1 to 2 of 2

Thread: How to set value to TextBox?

  1. #1
    Join Date
    Feb 2013
    Posts
    4

    Question How to set value to TextBox?

    Dear The Expert,

    How to set value to TextBox?
    I am trying to do the following but no luck

    document.getElementByName('TextBox1')[0].value = "Hello";
    document.getElementByName('TextBox2')[0].value = "World";

  2. #2
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,391
    getElementsByName() function returns a collection (similar to, but not, an array)

    Add an "id='???'" to your TextBox elements and reference them by:
    Code:
    document.getElementById('TextBox1').value = 'Hello';
    document.getElementById('TextBox2').value = 'World';

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