Johny Funny Johny Funny - 1 year ago 71
Javascript Question

Save and show input value in session storage

I have input number and button with text on subpage.

<input id="quantity" type="number">

I want to save value from input and show on button.

<a id="button2" data-role="button">You have "value" coins</a>

How i can do it?

Answer Source

If I understood well,

Here is solution

    var quantity=$(this).val();
    $('a').text('You have ' +  sessionStorage.getItem('quantity') +'  coins');
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download