Jacopo Rizzi
Jacopo Rizzi

Reputation: 3

disable keypress event on event change

I have a slider of questions. I want only the click of a few radio input the change event is active on my slider. But if you accidentally press a keyboard button still activates the slider. is there any way to disable the keypress event change?

$($slider).change(function () { // funzione principale.
  if (currentNodeNum != lastNodeNum){
    cleanArray();
  }
  nextNode();
  rightSlider();
});

Upvotes: 0

Views: 106

Answers (1)

max
max

Reputation: 8687

You can use this code:

$('#your-checkbox-or-radio').keydown(false);

$($slider).change(function () {
  if (currentNodeNum != lastNodeNum){
    cleanArray();
  }
  nextNode();
  rightSlider();
});

Upvotes: 2

Related Questions