How can I remove specific date range from dropdown date field?

I created a new registration form using WP FORMS. Need to remove the date range from 2017 to 2000 from the form field "My Birthday" on this page - https://manilaconnection.com
https://static.livechatinc.com/8801096/OUW48HL6BL/884347cdd4b3cfd53a39de68e19262ee/Birthday.png

    Huberson

    Hey Meg,
    Try adding this JS snippet to your custom JavaScript:

    var all_years = document.getElementById('wpforms-field_6-year');
    function markDateRange(years) {
    	for (var i = 1; i < years.length; i++) {
    		if(years[i].value > 1999) {
    			years[i].className = 'remove-year';
    		}
    	}
    }
    
    markDateRange(all_years);
    
    var years2remove = document.getElementsByClassName('remove-year');
    while (years2remove[0]) {
    	years2remove[0].remove();
    }

    You can use "Add Custom JS" option of Simple Custom CSS & JS plugin to do that.

    If that doesn't take care of it let us know and we will check that.

    Best,
    Huberson

    Huberson

    Hi there,
    Strange, it works fine when I test it. Try clearing or resting any caching, this might be causing the issue. You can also test the below scripts. Both do the same thing so you might want to try them individually.

    2

    jQuery(document).ready(function($){
    	var all_years = $('#wpforms-field_6-year').children();
    
    	all_years.each( function (index) {
    		if( !isNaN( $(this).val() ) && $(this).val() > 1999 ) {
    			$(this).addClass('remove-year');
    		}
    	});
    
    	var removed_years = $('.remove-year').remove();
    });

    3

    var all_years = jQuery('#wpforms-field_6-year').children();
    
    all_years.each( function (index) {
    	if( !isNaN( jQuery(this).val() ) && jQuery(this).val() > 1999 ) {
    		jQuery(this).addClass('remove-year');
    	}
    });

    If that doesn't work, you could try adding any of the scripts in a javascript file and add it under your theme js folder. You'll then include the script by adding this snippet in functions.php file locate inside the active theme directory:
    wp_enqueue_script( 'script', get_template_directory_uri() . '/js/yourscript.js', array ( 'jquery' ), 1.1, true);

    Feel free to ask additional information if needed.