There are a number of issues with your code but most importantly you need to call val
on the text input. Here is how your make_year_created_equal_4_chars
function might look:
function make_year_created_equal_4_chars() {
?>
<script type="text/javascript">
// This is a shorthand for "jQuery(document).ready()"
jQuery(function($) {
$('#acf-field-artwork_created').blur(function() {
// Please notice the declaration of 'selected_length'.
// It is important to declare it with 'var' so that
// you don't end up with it in the global scope.
var selected_length = $(this).val().length;
if (selected_length != 4) {
alert( 'A 4 digit year must be entered in the Artwork Created field' );
}
});
});
</script>
<?php
}