Reputation: 799
I have a problem with my datepicker. I use http://dev.jtsage.com/jQM-DateBox2/ for the picker.
As you see in my fiddle: http://jsfiddle.net/SrHNe/ It does not change page, even thoug it is trigging the alert
$('#datepicker').on('change', function(e,p) {
var date = $(this).val();
var location = "index.php?date=" + date;
alert(location);
window.location.href(location);
});
I have tried with window.location.assign(location) also, but here it will only work on the today button "gå til i dag" in the buttom of the daypicker. ? how can that be? I can not use mobile.changePage( to [, options ] ) because I need the changing without ajax.
Upvotes: 1
Views: 161
Reputation: 262939
window.location.href
is a property, not a method. You have to assign to it instead of calling it:
window.location.href = location;
EDIT: The second problem seems to come from the way jQuery Mobile dismisses the date box popup. It looks like it involves changing pages, so assigning to location.href
will not work properly unless you delay it slightly with setTimeout()
:
window.setTimeout(function() {
window.location.href = location;
}, 10);
You will find an updated fiddle here.
Upvotes: 1