Johny Funny Johny Funny - 5 months ago 35
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?


If I understood well,

Here is solution

    var quantity=$(this).val();
    $('a').text('You have ' +  sessionStorage.getItem('quantity') +'  coins');