Trying to get javascript to insert a string into a textbox or label in is this possible? (error: document.getElementById(..) is null or not an object)

adypips used Ask the Experts™
Hi I am trying to get the below javascript code to insert into a textbox. Note this is stored in an page.
 I would like to try and store in an label if possible or a textbox (if this is not possible a normal html textbox would do).

        <input id="Text1" type="text" />

This is not working I am currently getting the following error message: document.getElementById(..) is null or not an object

<script type="text/javascript">
document.getElementById("Text1").value= "Will this store";

Open in new window

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
solved..  see link 

Depends on position of javascript in head or below the textbox or lablel (if you put above -to javascript it renders top to bottom i.e that element doesnt exist if above).

did your <input id="Text1" type="text" /> has runat="server" attribute ?

what is id of this Text1 in View source of browser.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial