Solution 1 :

There is no special type for the “value” object.

for example textContent.value where textContent is a textbox.

In this case, textContent.value will give you the value in that textbox but its type will be string.

Accessing password field:

var password = textContent.value;

Assigning password to DOM object:

textContent.value = password;

Solution 2 :

var x = String(textContent.value);

Problem :

I am trying to create a custom password input system. Currently, the password is saved as a string. For example, I would have a password variable like this:

var password = "ABCDEFGH";

However, when using a normal textbox, and input passwords, the value us returned as a value object, for example textContent.value where textContent is a textbox. Since there are no data types in javascript unlike Java, how can I make the password, which is currently a string, into the same type as a value object?

Comments

Comment posted by Lee Taylor

What exactly are you trying to achieve? If you’re using client-side javascript to handle passwords then this isn’t going to work.

Comment posted by dabishan

.value

Comment posted by Honk der Hase

What? There is no such thing like a value object… String is perfectly fine for passwords.

Comment posted by StackSlave

DOM contents

By