In my code, $("#date") is a textfield with jquery datepicker attached. In the code below, when I select a date, firebug shows this error this.val is not a function
$("#date").change(function(){
var mydate = this.val();
alert(mydate);
});
But when I change this.val() with $("#date").val(), it works perfectly and alerts the selected date. Can anyone point out why this.val() is not working?
EDIT
Sorry, $this was a typo. I actually used this.val(), not $this.val()
thisin your event function isn’t a jquery object, it’s a dom object. Address it as$(this)and it should work for you.