In order to access the
form element, we can use the method getElementById() like this:var name_element = document.getElementById('txt_name');
The getElementById() call returns the input element object with ID ‘txt_name’ . Once we have the object, we can get the properties and call the methods of the object. For example, to get the value of the input element, get the value attribute.
</pre> <div> <div><code>var</code> <code>name = name_element.value;</code></div> </div> <pre>
Similarly, it is possible to access the <form> element:
</pre> <div><code>var</code> <code>frm_element = document.getElementById (</code><code>'subscribe_frm'</code><code>);</code></div> <div>
0 comments:
Post a Comment