Quantcast
Channel: WordPress.org Forums » [Contact Form 7] Support
Viewing all articles
Browse latest Browse all 49500

iconoclastix on "[Plugin: Contact Form 7] Disable/block specific dates from datepicker?"

$
0
0

I found this code:

<script type="text/javascript">
	var unavailableDates = ["1-9-2013", "2-9-2013", "3-9-2013", "4-9-2013", "5-9-2013"];

	function unavailable(date) {
			dmy = date.getDate() + "-" + (date.getMonth() + 1) + "-" + date.getFullYear();
			if (jQuery.inArray(dmy, unavailableDates) == -1) {
				return [true, ""];
			} else {
				return [false, "", "Unavailable"];
		}
	}

		jQuery(function() {
			jQuery( '#dpick' ).datepicker({
				dateFormat: 'dd MM yy',
				beforeShowDay: unavailable
		});

	});
</script>

and it seems to work fine in jsfiddle, but it won't work when I put it on my site. I added it in the header.php file just below the wp_head() call and just above the </head> tag (so it's after the JS/jQuery libraries)...I've set it to match the id on my datepicker field, but I'm still getting a JS error in console...can anyone help me out? Seems like it should be easy to get it working but I'm probably just missing some small formatting thing...


Viewing all articles
Browse latest Browse all 49500

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>