'Button values from Multiple button using document.querySelector() [duplicate]

I have 3 buttons

<button role="button" value="pro" id="proRegister">Pro</button>
<button role="button" value="proplus" id="proRegister">ProPlus</button>
<button role="button" value="premium" id="proRegister">Premium</button>

When I click the 'Pro' button, I want to get the 'pro' value (from the button). Likewise I want to get corresponding button values using the document.querySelector() function



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source