well guys , i'm new in here ... how can i check the values on different button with the same id?
sample code:
<button onclick="checkValue();" id="price" value="1">
<button onclick="checkValue();" id="price" value="2">
<button onclick="checkValue();" id="price" value="3">
<script>
function checkValue()
{
var but = document.getElementById("price").value;
console.log(but);
}
</script>
well .. how can i obtain 1 or 2 or 3 when it was clicked?
idshould be unique and useclassfor group of elementsame id. Useclassinstead.