Adding onchange event to Mootools datepicker

I have a datepicker field setup like this and it works fine:

		<input
			readonly='readonly'
			name='newInternalDate'
			id='newInternalDate'
			type='text'
			value='<?php echo $perfdate;?>'
			class='date date_toggled order_date'
			style='background-color:rgb(210,255,210);width:85px;'
		/>

I would like to raise an alert when the value is changed. I’ve added this:
<input

onchange=‘alert(“here”);’
/>
but it doesn’t work. Anyone know how to make it work please?
Thanks

Not sure if this makes a difference, but you have the input marked readonly, so it should never change (which maybe why your alert isn’t getting invoked)

Thanks. I removed that line and it makes no difference. Actually the fact that it’s marked readonly doesn’t mean it can’t change, only that it can’t be changed in the usual way of typing something into the box. It can still be changed by JS or php.

It can’t be changed with PHP in a way that would trigger the onchange event, it’ll always have to be triggered via Javascript.

Even then, changing the value of an input box programmatically won’t actually trigger the onchange event…I know, weird. Wherever you’re changing the value in your script, add:

document.getElementById('newInternalDate').onchange();

or if you’re using jQuery:

$('#newInternalDate').change();

Demo: http://jsfiddle.net/pAkx8/
Uncomment the javascript line to see the alert message.