Fixup js/tools/statesManagement.js

Replace == with === and != with !==
This commit is contained in:
Milow
2012-11-23 23:02:28 -06:00
parent 3f01a6f587
commit 9c5984178f
+5 -5
View File
@@ -11,14 +11,14 @@ function bindStateInputAndUpdate()
updateZipCode();
});
if ($('select#id_country_invoice').length != 0)
if ($('select#id_country_invoice').length !== 0)
{
$('select#id_country_invoice').change(function(){
updateState('invoice');
updateNeedIDNumber('invoice');
updateZipCode();
});
if ($('select#id_country_invoice:visible').length != 0)
if ($('select#id_country_invoice:visible').length !== 0)
{
updateState('invoice');
updateNeedIDNumber('invoice');
@@ -35,10 +35,10 @@ function updateState(suffix)
{
$('select#id_state'+(suffix !== undefined ? '_'+suffix : '')+' option:not(:first-child)').remove();
var states = countries[$('select#id_country'+(suffix !== undefined ? '_'+suffix : '')).val()];
if(typeof(states) != 'undefined')
if(typeof(states) !== 'undefined')
{
$(states).each(function (key, item){
$('select#id_state'+(suffix !== undefined ? '_'+suffix : '')).append('<option value="'+item.id+'"'+ (idSelectedCountry == item.id ? ' selected="selected"' : '') + '>'+item.name+'</option>');
$('select#id_state'+(suffix !== undefined ? '_'+suffix : '')).append('<option value="'+item.id+'"'+ (idSelectedCountry === item.id ? ' selected="selected"' : '') + '>'+item.name+'</option>');
});
$('p.id_state'+(suffix !== undefined ? '_'+suffix : '')+':hidden').slideDown('slow');
@@ -62,7 +62,7 @@ function updateZipCode(suffix)
{
var idCountry = parseInt($('select#id_country'+(suffix !== undefined ? '_'+suffix : '')).val());
if (countriesNeedZipCode[idCountry] != 0)
if (countriesNeedZipCode[idCountry] !== 0)
$('.postcode'+(suffix !== undefined ? '_'+suffix : '')).slideDown('slow');
else
$('.postcode'+(suffix !== undefined ? '_'+suffix : '')).slideUp('fast');