$('#stwform').validate({ rules: { choice: { required: true }, 'about-gph': { required: true }, 'about-str': { required: true }, 'about-other': { required: true }, name: { required: false }, kana: { required: true, katakana: true }, gender: { required: true }, birth1: { required: true }, birth2: { required: true }, birth3: { required: true }, email: { required: true, email: true }, tel: { required: true, number: true }, 'postal-code': { required: true, number: true }, 'address-level1': { required: true }, 'address-level2': { required: true }, situation: { required:true }, pack_day1: { required: true }, pack_day2: { required: true }, pack_day3: { required: true }, j_days: { required: true, number: true }, j_name: { required: true }, check_in_day1: { required:true }, check_in_day2: { required: true }, review: { required: true }, agree: { required:true } }, messages: { choice: { required: 'お問い合わせ先を選択してください' }, 'about-gph': { required: 'お問い合わせ内容を選択してください' }, 'about-str': { required: 'お問い合わせ内容を選択してください' }, 'about-other': { required: 'お問い合わせ内容を選択してください' }, name: { required: 'お名前を入力してください' }, kana: { required: 'フリガナを入力してください' }, gender: { required: '性別を選択してください' }, birth1: { required: '生年月日を選択してください' }, birth2: { required: '生年月日を選択してください' }, birth3: { required: '生年月日を選択してください' }, email: { required: 'メールアドレスを入力してください' }, tel: { required: '電話番号を入力してください' }, 'postal-code': { required: '郵便番号を入力してください' }, 'address-level1': { required: '住所を入力してください' }, 'address-level2': { required: '住所を入力してください' }, situation: { required: '現在の状況を選択してください' }, pack_day1: { required: '宿泊開始日を選択してください' }, pack_day2: { required: '宿泊開始日を選択してください' }, pack_day3: { required: '宿泊開始日を選択してください' }, j_days: { required: '宿泊数を入力してください' }, check_in_day1: { required: 'チェクイン時間を選択してください' }, check_in_day2: { required: 'チェクイン時間を選択してください' }, review: { required: 'レビュー投稿をするか選択してください' }, agree: { required: '個人情報の取扱への同意が必要です' } }, groups: { birth: "birth1 birth2 birth3", pack_day: "pack_day1 pack_day2 pack_day3", check_in_day: "check_in_day1 check_in_day2" }, errorPlacement: function (error, element) { error.insertAfter(element); // ここが呼び出される if (element.attr("name") == "choice") error.insertAfter("#choice_err"); if (element.attr("name") == "about-gph") error.insertAfter("#about-gph_err"); if (element.attr("name") == "about-str") error.insertAfter("#about-str_err"); if (element.attr("name") == "about-other") error.insertAfter("#about-other_err"); if (element.attr("name") == "gender") error.insertAfter("#gender_err"); if (element.attr("name") == "agree") error.insertAfter("#agree_err"); if (element.attr("name") == "birth1" || element.attr("name") == "birth2" || element.attr("name") == "birth3") error.insertAfter("#birth_err"); if (element.attr("name") == "pack_day1" || element.attr("name") == "pack_day2" || element.attr("name") == "pack_day3") error.insertAfter("#pack_day_err"); if (element.attr("name") == "check_in_day1" || element.attr("name") == "check_in_day2") error.insertAfter("#check_in_day_err"); if (element.attr("name") == "situation") error.insertAfter("#situation_err"); if (element.attr("name") == "j_days") error.insertAfter("#j_days_err"); if (element.attr("name") == "review") error.insertAfter("#review_err"); }, submitHandler: function(form) { if ( $('#btn1').val() == '上記の内容で送信する' ){ $('#stwform').find(':input:not([type=button]):not([type=submit])').attr('disabled', false); $('#stwform').attr('action','?act=send'); form.submit(); }else{ $('#stwform').find(':input:not([type=button]):not([type=submit])').attr('disabled', true); $('#btn1').val('上記の内容で送信する'); $('.form_wrap-privacypolicy').hide(); console.log('ok'); $('#btn2').css('display','block'); } }, focusInvalid:"true" }); jQuery.validator.addMethod("katakana", function(value, element) { return this.optional(element) || /^[ア-ン゛゜ァ-ォャ-ョー「」、  ]+$/.test(value); }, "全角カタカナを入力してください" ); $('#btn2').click(function () { $('.form_wrap-privacypolicy').show(); $('#stwform').find(':input:not([type=button]):not([type=submit])').attr('disabled', false); $('#btn1').val('確認する'); $(this).hide(); });