Contact Form 7 5.6でjQueryのchange(fn)が正常に動作しない
-
いつもお世話になります。
Contact Form 7を5.5.6.1から5.6にバージョンアップしたところ、jQueryのchange(fn)を使った表示/非表示が効かなくなりました。
また、チェックボックスまたはラジオボタンをチェックする度に、入力していない必須項目すべてのエラーメッセージ(入力してください)が出てしまいます。具体的にchange(fn)では、チェックボックスの選択肢により、他のチェックボックスやテキストエリアにclass付加/削除を行い、cssのdisplay:noneによる表示/非表示を行っていました(下記例)。
`$(‘.tool-site’).addClass(‘hide’);
$(‘.tool-hp’).addClass(‘hide’);
$(‘.tool-other’).addClass(‘hide’);
$(‘.tool-n input[type=”checkbox”]’).change(function(){
$(‘.tool-site’).addClass(‘hide’);
$(‘.tool-hp’).addClass(‘hide’);
$(‘.tool-other’).addClass(‘hide’);
$(‘.hp-route-n .wpcf7-list-item:eq(2) input’).prop(‘checked’, true);
$(‘.hp-route-n .wpcf7-list-item:eq(2)’).removeClass(‘hide’);
if($(‘.tool-n .wpcf7-list-item:eq(1) input:checkbox:checked’).val() == “テキスト1″) {
$(‘.tool-site’).removeClass(‘hide’);
$(‘.tool-site input[type=”text”]’).val(”);
$(‘.site-name-n input[type=”text”]’).attr(‘placeholder’, ‘テキスト2’);
$(‘.site-keyword-n input[type=”text”]’).attr(‘placeholder’, ‘テキスト3’);
} else {
$(‘.tool-site input[type=”text”]’).val(‘テキスト4’);
$(‘.tool-site input[type=”text”]’).removeAttr(‘placeholder’);
}
if($(‘.tool-n .wpcf7-list-item:eq(4) input:checkbox:checked’).val() == “テキスト5″) {
$(‘.tool-hp’).removeClass(‘hide’);
$(‘.hp-route-n .wpcf7-list-item:eq(2) input’).prop(‘checked’, false);
$(‘.hp-route-n .wpcf7-list-item:eq(2)’).addClass(‘hide’);
} else {
$(‘.hp-route-n .wpcf7-list-item:eq(0) input’).prop(‘checked’, false);
$(‘.hp-route-n .wpcf7-list-item:eq(1) input’).prop(‘checked’, false);
$(‘.tool-hp .input-wrap’).addClass(‘hide’);
$(‘div.hp-keyword input[type=”text”]’).val(‘テキスト6’);
$(‘div.hp-keyword input[type=”text”]’).removeAttr(‘placeholder’);
$(‘div.hp-other textarea’).val(‘テキスト7’);
$(‘div.hp-other textarea’).removeAttr(‘placeholder’);
}
if($(‘.tool-n .wpcf7-list-item:eq(5) input:checkbox:checked’).val() == “テキスト8″) {
$(‘.tool-other’).removeClass(‘hide’);
$(‘.tool-other textarea’).val(”);
$(‘.tool-other textarea’).attr(‘placeholder’, ‘テキスト9’);
} else {
$(‘.tool-other textarea’).val(‘テキスト10’);
$(‘.tool-other textarea’).removeAttr(‘placeholder’);
}
}).trigger(‘change’);`5.6にしてから、非表示のままで動作しなくなり、5.5.6.1に戻すと動作します。
この現象について何かご存じの方がいらっしゃったら、ご教示願います。
何卒よろしくお願いいたします。
- トピック「Contact Form 7 5.6でjQueryのchange(fn)が正常に動作しない」には新たに返信することはできません。