From ec6f6f091ada1422ebc77e7af15d8d0b66eef64c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Luiz=20Lorencetti?= Date: Mon, 3 Jul 2017 00:09:16 -0300 Subject: [PATCH] Disable widgets while loading the cities for the selected state --- pets/static/js/pets.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pets/static/js/pets.js b/pets/static/js/pets.js index 21ea70c..7a6803b 100644 --- a/pets/static/js/pets.js +++ b/pets/static/js/pets.js @@ -18,8 +18,8 @@ $(document).ready(function () { var stateWidget = $(this); var cityWidget = $('#id_city'); - stateWidget.addClass('disabled'); - cityWidget.addClass('disabled'); + stateWidget.prop('disabled', true); + cityWidget.prop('disabled', true); cityWidget.find('option').remove(); $.get('/api/cities/?limit=1000&state=' + stateWidget.val(), function (data) { cityWidget.append(new Option('------------', '')); @@ -27,8 +27,8 @@ $(document).ready(function () { cityWidget.append(new Option(city.name, city.code)); }); }).done(function () { - cityWidget.removeClass('disabled'); - stateWidget.removeClass('disabled'); + cityWidget.prop('disabled', false); + stateWidget.prop('disabled', false); }); });