<input type="submit" value="1" id="a"> <script> var a = document.getElementById('a'); a.onclick = go; function go() { alert(a.getAttribute('value')); } </script>