0

I recently put my code in a self-executing block.

Now when I try to run the code it returns an error of file VM6963:18 in the console:

Uncaught TypeError: Cannot read property 'value' of null

(function() {
    "use strict";

    var input = document.getElementById("find");

    (function placeFinder(input) {
        var autocomplete = new google.maps.places.Autocomplete(input);

        google.maps.event.addListener(autocomplete, "place_changed", function() {
            var place = autocomplete.getPlace();

            if (!place.hasOwnProperty("formatted_address")) {
                input.setAttribute("title", input.value);

                return null;
            }

            input.setAttribute("title", place.formatted_address);
        });
    })(input);
})();
Kid Diamond
  • 1,953
  • 8
  • 32
  • 67

0 Answers0