I have a form like this:
<form id="surveyForm" method="post" action="submit.php">
<input type="text" id="good" value="0" />
<input type="text" id="bad" value="1" />
</form>
I want to send value with “g” and “b” keyboard buttons. If “g” button is pressed, form submits with “0” value. How can do this with jquery? I have searched in site but I cant find any specific topic.
Thanks in advance
Try this:
Alternatively you could have one input which you change the value of depending on the key pressed and then submit your form. That would be a little more elegant IMO.