Simple TextBox question
I'm trying to use a variable to write to a textbox and I can't seem to nail the syntax. I've tried searching but I couldn't find anything (probably because I don't know what exactly to search for).
variable = textbox1;
Thanks for your help
Welcome to WebDeveloper.com Forums, Kevin.
Perhaps this will help.
I've read that entire page and I've tried everything I can think of.
I just can't seem to get the function to populate the textBox using a variable.
Do you have any other suggestions or code to try?
Thanks again for your help
This is what that page showed applied to your example:
variable = 'textbox1';
That was it - I can't thank you enough.
I was trying getElementsByID[variable] and getElementsByName[variable]
There is no getElementsByID. Since IDs should be uniquely applied to one element in a document.
getElementByID() (singular) and getElementsByName() are methods of document and use parentheses, not array notation brackets the way arrays and NodeLists do.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)