Possible Duplicate:
Why does jQuery or a DOM method such as `getElementById` not find the element?
I have this script:
<script>
var dataoriginale = document.getElementById("savedataoriginale").value;
</script>
and this text field:
<input name="savedataoriginale" id="savedataoriginale" type="text" value="testtest">
but when I try to print the javascript var
<script>document.write(dataoriginale)</script>
I get undefined.
Why? How can I fix that?