Solution 1 :

var username_val = document.getElementById('testx').value;
$("#test").text(username_val);

You just had the wrong syntax.

Problem :

I have a login page, where users only have 1 input box = for their username. Once they enter their username, this form hides itself and the next form for password shows.

On the top left corner of the second form, there is a left arrow icon (that goes back to the first form – the username form).

On the right of the left arrow icon, I’ve tried putting the value of what they entered in the first input box. Their username. But I am unsuccessful. It seems that I cannot do that, since all I end up doing is setting the text next to the left arrow icon to a predefined value. I can’t get the label to update to the username they’ve entered on the previous form.

The website consists of HTML,CSS,Javascript with only 1 PHP POST request.

What I’ve tried so far:

$("#test").text('id$=testx');

I’m really clueless when it comes to scripts. After this code, the value of label shows id$=testx

I need it to show the input value of input box with id="testx".

As you can also see the label id is “test”

Thanks for any help in advance.

Comments

Comment posted by Your Friendly Guy

Thank you for answering. It’s changing it now, but not from the first try. When I put that and click enter, it goes to the second form. The second form’s label is empty again, but when I go back and press enter again – then it appears. Is it possible to get the value of the label replaced from the first try?

Comment posted by mike510a

You will need to provide more of the code so that we can understand what is happening better.

By