onclick on all inputs
Hello, I have to write function in javascript that get value of specific input from all inputs type=button and display it on click. What I have so far is: function click() { var input = document.querySelectorAll('input[type=button]').value; document.frame.screen.value = input; } document.getElementById('firstbutton').onclick = click; Now I want to understand how can I to get specific value of "firstbutton" when I click on it. I know that if I put var input = document.querySelectorAll('input[type=button]')[0].value in function it will work but I want to write function that will return value on specific button from all buttons when I click it. Easier... when I click "firstbutton" I got value of 'firstbutton'. When I click "secondbutton" I got value of secondbutton and so far... and all of that with one function.... and I stuck... Any help? P.S. I cant use jQuery and loops in that task.