at index.html
function pay(id)
{
localStorage.thing = id;
}
<button type="button" id="opt1" onclick="pay(this.id)" onclick="window.location.href = 'payment.html'"></button>
at payment.html
window.onload = function()
{
def();
};
function def()
{
document.getElementById('card').innerHTML = localStorage.thing;
}
<h1 id="card"></h1>
my main goal is to define button's id from payment.html page through element but when i click the button nothing's working.