javascript validate uk date
<p>I am trying to validate a date in the format dd/mm/yyyy using a function I have found online, but I get this error : 'input is null'</p>

<p>Can anybody tell me where my syntax is wrong?</p>

<pre><code>if (validateDate($("#&lt;%=StartDate.ClientID%&gt;")) == false) {
                alert("not date");
            }
            else {
                alert("date");
            }

function validateDate(dtControl) {
        var input = document.getElementById(dtControl)
        var validformat = /^\d{1,2}\/\d{1,2}\/\d{4}$/ //Basic check for format validity
        var returnval = false
        if (!validformat.test(input.value))
            alert('Invalid Date Format. Please correct.')
        else { //Detailed check for valid date ranges
            var dayfield = input.value.split("/")[0]
            var monthfield = input.value.split("/")[1]
            var yearfield = input.value.split("/")[2]

            var dayobj = new Date(yearfield, monthfield - 1, dayfield)
            if ((dayobj.getMonth() + 1 != monthfield) || (dayobj.getDate() != dayfield) || (dayobj.getFullYear() != yearfield))
                alert('Invalid Day, Month, or Year range detected. Please correct.')
            else {
                returnval = true
            }
        }
        if (returnval == false) input.focus()
        return returnval
    } 
</code></pre>
