Rumah > Soal Jawab > teks badan
P粉6920525132023-08-07 19:41:24
Cuba ini
var dateRange = '"'+startYear+' : '+endYear+'"';
Letakkan pembolehubah "dateRange" seperti berikut:
// Replace "billing_date_of_birth" with the ID or name of your date of birth field $('#billing_date_of_birth').datepicker('option', { yearRange: dateRange });
P粉0716024062023-08-07 16:12:42
Tambahkan fungsi ini pada fail function.php, harap ini membantu anda.
<?php function extend_date_of_birth_range() { ?> <script> jQuery(function($) { var currentYear = new Date().getFullYear(); var startYear = currentYear - 99; var endYear = currentYear - 10; var dateRange = '"'+startYear+' : '+endYear+'"'; // Replace "billing_date_of_birth" with the ID or name of your date of birth field $('#billing_date_of_birth').datepicker('option', { yearRange: dateRange }); }); </script> <?php } add_action('wp_footer', 'extend_date_of_birth_range'); ?>