I would like to add a string of text to a text field using JavaScript but I don't want to use the onClick or onLoad events to do so.
I simply want the JavaScript to be executed as soon as the browser reads it and the JavaScript will be within the body of the html.
The text field is something like:
<form action="" method="post" name="formname" id="user-registration-form">
<input type="text" name="edit-form" id="edit-form" />
</form>
I have tried something like this but it doesn't work:
<script type="text/javascript"> edit-form.value="the new value"; </script>
How can I do this?