When it is in a form, you can handle it using JS (or another language) when submitted. When you want to handle it immediately when clicked, you can use a JavaScript routine to get control and obtain the value via the DOM. Which method do you want to use?
Comment