Home > Web Front-end > JS Tutorial > Sample code for javascript to obtain form elements in form_javascript skills

Sample code for javascript to obtain form elements in form_javascript skills

WBOY
Release: 2016-05-16 16:59:59
Original
1085 people have browsed it

//Get the form object

var form=document.getElementById(‘my_form’);

//Username input object user_name is the name attribute of the object

var userName=form.user_name;

//Clear username

userName.value='';

//User password input object password is the name attribute of the object

var password=form.password;

//Clear user password

password.value=”;

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template