dimanche 28 octobre 2018

if checkbox is checked press enter to trigger button click

I have a form which shows 1 question at a time and i have to click next in order to go to the next question. The user have to select one option to move to the other questions. I want to do is if the user selects a option from the checkbox and press enter it will trigger the next button and move to the other questions. i cant possibly do it. what is wrong with my code? jquery code..

$('input[name="trading_for_at_least_6_months"]:checked').keypress(function (event) {
if (event.keyCode === 13) {
    $(".comnext1").click();
}});

I am trying to code is to see if any of the options is checked by checking the input names and if it is, when enter key is pressed trigger next button. I have other next button so i dont want to trigger them too.




Aucun commentaire:

Enregistrer un commentaire