Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

form editing using javascript need some help


Mb0742's Avatar
Ultimate Headshot
0 0

I need this to edit a form using javascript and I would like to know the proper way to do it in javascript rather than using firebug, because I can't ask the people on my site to do the editing themselves. I want to be able to change their forms in real time.

What I need to know is how to edit what is submitted in a form. There is a button <form id="myfrom"> <input type="submit" id="ready" value="ready" name="ready"/> ….

How do I using javascript change the form button values 'value' and 'name' from 'ready' to 'not ready'

Thank you guys so much.


ghost's Avatar
0 0

Since your button has both a name and id, you have two options available to you. We're not going to get any deeper into the DOM at this point; the following methods are fine for what you're trying to achieve.

By name: document.formname.elementname.value

By id: document.getElementById(elementid).value