how to access an object in a form with getElementById?

C

Carl

Assume a form with a button

<form id="myform"
<input id="mybutton" type="button">
</form>

how can i use getElementById to access the button?
I tried this:
var a
a=document.getElementById("mybutton")

but i get an error "a is not an object"
Any idea?
Carl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,085
Messages
2,570,597
Members
47,218
Latest member
GracieDebo

Latest Threads

Top