function deleteoption($this, styleclass) { if (MappinglocationsArr != null) { var removeLocation = $($($this).parent())["0"].outerText; var itemIndex = -1; $.each(MappinglocationsArr, function (index, data) { if (data.location == removeLocation) { itemIndex = indev; } }); MappinglocationsArr.splice(itemIndex, 1); } $($this).parent().remove(); if ($('.' + styleclass + '>span').length == 0) { $('.' + styleclass).hide(); $('#txtAddress').val(''); } } function GoogleOption(text, latitude, longitude, styleclass) { return $("" + text + "x"); } function getpreferredareas(styleclass) { var objpreferredarea = {}; var preferredlocations = ""; var lstlatlng = []; $("." + styleclass + " .innerspan").each(function () { var preferredarea = $(this).text().trim().substring(0, $(this).text().length - 1); preferredlocations += preferredarea + "|"; lstlatlng.push({ latitude: $(this).attr('latitude'), longitude: $(this).attr('longitude'), preferredarea: preferredarea }); }); objpreferredarea.preferredlocations = preferredlocations.trim().substring(0, preferredlocations.length - 1); objpreferredarea.lstlatlng = lstlatlng; return objpreferredarea; } function applyautocomplete(input, styleclass) { var autocomplete = new google.maps.places.Autocomplete(input); //code to change place starts google.maps.event.addListener(autocomplete, 'place_changed', function () { var place = autocomplete.getPlace(); if (!place.geometry) { return; } $("." + styleclass).show(); var isAlreadyExist = false; $("." + styleclass + ">span").each(function () { if ($(this).text().trim().toLowerCase().indexOf($(input).val().trim().toLowerCase()) > -1) { isAlreadyExist = true; } }); if (!isAlreadyExist) { $("." + styleclass).append(new GoogleOption($(input).val(), place.geometry.location.lat(), place.geometry.location.lng(), styleclass)); $(input).val(''); } return false; //code to change place ends }); } function applyautocompleteNumber(input, styleclass,id) { var autocomplete = new google.maps.places.Autocomplete(input); //code to change place starts google.maps.event.addListener(autocomplete, 'place_changed', function () { var place = autocomplete.getPlace(); if (!place.geometry) { return; } addLocation(place,input, styleclass,id); return false; //code to change place ends }); } function GoogleOptionNumber(text, latitude, longitude, styleclass,id) { var addressCount = (MappinglocationsArr == null? 1 : MappinglocationsArr.length + 1); return $("