privacy.js
16 lines
| 1 | ;(function ($) { |
| 2 | var $cookieName = $('[name="' + window.advads_privacy.option_key + '[custom-cookie-name]'), |
| 3 | $method = $('[name="' + window.advads_privacy.option_key + '[consent-method]"]:checked'); |
| 4 | |
| 5 | // set required if radios change. |
| 6 | $('[name="' + window.advads_privacy.option_key + '[consent-method]"]').on('change', function () { |
| 7 | $method = $('[name="' + window.advads_privacy.option_key + '[consent-method]"]:checked'); |
| 8 | $cookieName.prop('required', $method.val() === 'custom'); |
| 9 | }); |
| 10 | |
| 11 | // if enabled status changes, set required. |
| 12 | $('[name="' + window.advads_privacy.option_key + '[enabled]"]').on('change', function () { |
| 13 | $cookieName.prop('required', ($(this).is(':checked') ? $method.val() === 'custom' : false)); |
| 14 | }); |
| 15 | })(jQuery); |
| 16 |