<button name="myButton" value="someValue" data-value="someDataValue">Click me! </button>
How do I use server-side javascript to access the button's data-value
? I only know how to use body-parser to access value
by writing req.body.myButton
.
You don't. Only the value
itself is posted by the browser. You can use client-side JavaScript to populate a hidden field with any extra information you need -- or to do the submission completely in JavaScript.