Categories:

JavaScript Kit > JavaScript Reference > Here

Password Object

Last updated: June 20th, 2004

The password field (<input type="password">) within your form can be accessed and manipulated using JavaScript via the corresponding Password object. To access a button in JavaScript, use the syntax:

document.myform.passwordfield //where myform and passwordfield are names of your form/element.
document.myform.elements[i] //where i is the position of the field within form

Events

Events Description
onBlur Code is executed when the focus is removed from the password field.
onFocus Code is executed when the focus is set on the password field.

Properties

Properties Description
disabled Boolean value that sets/ returns whether the field is disabled.
form References the form that contains the password field.
name Reflects the name of the password field (the name attribute).
type A property available on all form elements, "type" returns the type of the calling form element, in this case, "password".
value A read/write string that specifies the value of the password field. Note that due to security reasons, some browsers may not return the actual value of the password when this property is invoked.

Methods

Methods Description
blur() Removes focus away from the password field.
focus() Sets focus on the password field.
select() Selects the input area of the password field.

Reference List

Right column

CopyRight (c) 2018 JavaScript Kit. NO PART may be reproduced without author's permission. Contact Info