.focus() を使用して、スライダーを次の画面に進めたいと思います。次へと戻るボタンがあります。ユーザーが次のボタンをクリックした場合、.focus() 関数でスライダーを進めたくありません。ただし、フォーカスが次のボタンにある場合は、フォーカスが次のボタン .click() 関数をトリガーするようにしたいと思います。
これが私が今持っている方法です。Tab キーを押して次のボタンにフォーカスを置くと、スライダーが進みます。次へボタンをクリックすると、スライダーが 2 回進みます。
$(".nextbutton4").focus(function() {
$(".nextbutton4").click();
});
if-else ステートメントを使用して focus() 関数の別のバージョンを思いつきましたが、機能しません。
// This allows a tab advancement to trigger the next action
$(".nextbutton4").focus(function() {
if (//This is where I would like to check whether the button was clicked) {
alert('Next Button is Clicked');
// Do Nothing
}
else {
alert('Next Button Not Clicked');
$(".nextbutton4").click();
}
});