[Fixed]-Only run JQuery on manual update

1👍

✅

Just use a variable that indicates if this is the first time that start date value is being set. and ignore changing end date value at this first time:

var firstTime = true;

 $("#id_start_date").change(function (){ if(!firstTime){
            json_to_select("{% url "get_end_dates_list" 4545645 %}".replace("4545645", $(this).val()), "#id_end_date");
  firstTime = false;}
        });

cheking the firsttime should be done when changing the value of the startdate and It might not be in the best place in my code, but its only to show the idea.

Leave a comment