在我的網站中添加一個 recaptcha 之前,我有一個表單,用于用戶將所有用戶輸入發布到我的數據庫中。但是,如果有一個字段仍然為空或值為 0,我會禁用提交按鈕。我使用 jQuery 來完成此操作我嘗試過使用 val() 方法來捕獲 recaptcha valeu 之類的東西,但似乎不起作用。這是我的 jQuery,用于在檢查所有字段后啟用提交或禁用它:$('#identity-next').attr('disabled', true); //disable the buttonfunction checkFilled() { $('form').on('keyup change', function () { if ($(name).val() != "" && $(birth_place).val() != 0 && $(birth_date).val() != "" && $(email).val() != "" && $(phone_number).val() != "" && $(address_province).val() != 0 && $(address_regency).val() != 0 && $(address_district).val() != 0 && $(specify_address).val() != 0 && $(captcha).val() != "") // the one that's not working { $('#identity-next').attr('disabled', false); return true; } else { $('#identity-next').attr('disabled', true); return false; } }); }checkFilled() //call the function這是我的驗證碼 div:<div id="captcha" name="g-recaptcha" class="g-recaptcha" data-sitekey="########################"></div> {!! NoCaptcha::renderJs() !!}<span class="text-danger">{{ $errors->first('g-recaptcha-response') }} </span>所以我希望我的 jquery 函數可以處理相同的功能,以便在所有字段都不為空時啟用提交按鈕,包括我的 recaptcha,我正在使用 recaptcha V2 btw。在這種情況下,我的按鈕將保持禁用狀態,因為驗證碼根本不返回任何值(?)。此致!。
如何獲取recaptcha值以便它可以用于條件檢查
慕森王
2021-10-14 10:12:00