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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 16:59:591131browse

//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=”;

Statement:
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