-3
A
答えて
0
これは私の作品=)
var d = new Date();
var h = d.getHours();
var m = d.getMinutes();
if(h==10){
if(m<=30){
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').removeAttr("selected");
jQuery('#order_wcj_checkout_field_3 option:nth-child(2)').attr("selected",'selected');
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').attr("disabled",'disabled');
}
else{
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').removeAttr("selected");
jQuery('#order_wcj_checkout_field_3 option:nth-child(3)').attr("selected",'selected');
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(2)').attr("disabled",'disabled');
}
}
else if(h==11){
if(m<=30){
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').removeAttr("selected");
jQuery('#order_wcj_checkout_field_3 option:nth-child(4)').attr("selected",'selected');
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(2)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(3)').attr("disabled",'disabled');
}
else{
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').removeAttr("selected");
jQuery('#order_wcj_checkout_field_3 option:nth-child(5)').attr("selected",'selected');
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(2)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(3)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(4)').attr("disabled",'disabled');
}
}
else if(h==12){
if(m<=30){
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').removeAttr("selected");
jQuery('#order_wcj_checkout_field_3 option:nth-child(6)').attr("selected",'selected');
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(2)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(3)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(4)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(5)').attr("disabled",'disabled');
}
else{
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').removeAttr("selected");
jQuery('#order_wcj_checkout_field_3 option:nth-child(7)').attr("selected",'selected');
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(2)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(3)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(4)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(5)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(6)').attr("disabled",'disabled');
}
}
else if(h==13){
if(m<=30){
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').removeAttr("selected");
jQuery('#order_wcj_checkout_field_3 option:nth-child(8)').attr("selected",'selected');
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(2)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(3)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(4)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(5)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(6)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(7)').attr("disabled",'disabled');
}
else{
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').removeAttr("selected");
jQuery('#order_wcj_checkout_field_3 option:nth-child(9)').attr("selected",'selected');
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(2)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(3)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(4)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(5)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(6)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(7)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(8)').attr("disabled",'disabled');
}
}
else if(h==14){
if(m<=30){
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').removeAttr("selected");
jQuery('#order_wcj_checkout_field_3 option:nth-child(10)').attr("selected",'selected');
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(2)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(3)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(4)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(5)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(6)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(7)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(8)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(9)').attr("disabled",'disabled');
}
else{
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').removeAttr("selected");
jQuery('#order_wcj_checkout_field_3 option:nth-child(11)').attr("selected",'selected');
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(2)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(3)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(4)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(5)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(6)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(7)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(8)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(9)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3 option:nth-child(10)').attr("disabled",'disabled');
}
}
else if(h>=15){
jQuery('#order_wcj_checkout_field_3 option:nth-child(10)').attr("disabled",'disabled');
jQuery('#order_wcj_checkout_field_3').append("<option value='00'>Hoje acabou. Compre com agendamento amanhã.</option>");
jQuery('#order_wcj_checkout_field_3 option:nth-child(1)').removeAttr("selected");
jQuery('#order_wcj_checkout_field_3 option:nth-child(11)').attr("selected",'selected');
}
関連する問題
- 1. ボタンに基づいて選択オプションを非表示、非表示、リセット
- 2. ラジオボタンの選択時にdivsを表示/非表示にする
- 3. 表示選択したオプション
- 4. 選択オプション(jQuery)に基づいて表の列を表示/非表示
- 5. jQuery構文補助フィルタテキストボックスキーストロークでオプションを選択(非表示)を選択
- 6. 特定のオプションを選択した後で非表示のフィールドを表示
- 7. ラジオの選択の表示/非表示
- 8. Div選択の非表示
- 9. 選択オプションがデフォルトの場合、非表示のdivを表示しない
- 10. jqueryで非表示の選択オプションの変更検出
- 11. 複数のテキストフィールドを選択オプションに基づいて非表示/表示する
- 12. 重複する反応選択オプションを非表示にする
- 13. 選択リストから任意のオプションを選択すると非表示のdivが表示されます
- 14. 他の選択値に基づいて選択オプションを非表示および表示
- 15. HTML-Formular:ユーザー選択時に与えられた選択オプションを表示
- 16. Aurelia - 選択オプションに基づいて要素を表示/非表示
- 17. 選択して非表示
- 18. jQueryの選択オプションで表示/非表示にしない理由
- 19. 複数選択:1つの選択で選択したオプションを無効/非表示/削除
- 20. 非表示のオプションを非表示IE
- 21. 別の選択オプションに基づいて選択オプションのドロップダウン値を表示
- 22. 角度2のオプションを選択すると、オプションの選択時に適切な値が表示されない
- 23. 複数選択ドロップダウンリストで選択したオプションを表示 - Yii2
- 24. 選択ボックスに「選択したオプション」を表示しますか?
- 25. 1つの色を選択するときにテキストボックスを表示し、同じ時間を非表示にする
- 26. jquery datatables列の表示/非表示が間違った選択を追加
- 27. スクロール内のアナログ時間ピッカービュー時間の選択を表示しない
- 28. 選択変更時にフォーム要素を非表示にする
- 29. ハイライト表示/非表示ハイライト表示の棒グラフ選択
- 30. howto選択ボックスにAJAX選択オプションが表示される
あなたはいくつかのコードを書くための少なくとも試みを持っています。短い答えは、もちろん、はいです。しかしまずそれを試してみてください。 – Difster
それぞれに同じクラスを与え、同じ配列内にそれらをすべてグループ化し、それを使っていくつかの操作を実行できます。しかし、それはこの質問の範囲を超えています。短い答えはyesです – Chris
助けてくれるコードを書いてください。 –