DateBox jQuery Mobile - min-attribute set after page load. enddate not allowed before startdate

StackOverflow https://stackoverflow.com/questions/19335605

  •  30-06-2022
  •  | 
  •  

Question

I want to ensure, that people can not choose an end date that is earlier than the start date in this fiddle: http://jsfiddle.net/pUQhA/3/

I have tried to set the min attribute to the date, when I update start date, but it will not work. I have tried to refresh, but it will still not work. What can I do?

$("#end_date").attr("min", $("#start_date").val());
$("#end_date").trigger("datebox", {"method":"dorefresh"});

When I do this, it sets the min-attr but I can still choose an date before the start date.

Was it helpful?

Solution

I found the solution:

$('element').datebox('applyMinMax')

And the date format for min must be %Y-%m-%d and not %d-%m-%Y as I had at first!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top