Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove placeholder text from Google Maps Places API

I'm using the Google Maps Places API Autocomplete function to provide a location autocomplete on a page, similar to this: https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-addressform

I'm also using Google Material Design Lite to style my input boxes. This is all working fine, apart from the placeholder text. MDL uses label tags to provide placeholder text and a highlighting underline, but the Google Maps Places API uses a placeholder attribute on the input tag, which appears to override the MDL placeholder text and stop the underline effect from working; in addition, it appears I can't style the placeholder text for it to be a different color/opacity.

I'd like to be able to turn off the Google Maps Places API placeholder text, but even setting the attribute to be an empty string appears to break the Google MDL label (the placeholder text doesn't appear).

Is there a way I can stop the Google Maps API from putting placeholder text in my input box?

like image 914
Robert Sharp Avatar asked Jan 12 '17 19:01

Robert Sharp


People also ask

How do I restrict Google places API?

Step 1: Ensure you're logged in with the Google account under which you created your Google Maps API key. Step 2: Navigate to Google Console Credentials screen and click to your API key to enter it. Step 3: In API restrictions section choose 'Restrict key' and click on 'Select APIs' dropdown.

Is Google places autocomplete free?

The autocomplete request is available at no charge, and the subsequent Place Details call gets charged based on regular Place Details pricing. A Place Details request generates Data SKUs (Basic, Contact, and/or Atmosphere) – depending on the fields that are specified in the request.

How do you refresh a place id?

You can refresh Place IDs at no charge, by making a Place Details request, specifying only the place_id field in the fields parameter. This will trigger the Places Details - ID Refresh SKU. However, this request might also return NOT_FOUND status code.

Is Google Map place API free?

Google Places API pricing and limitsThere are 1,000 free Places API lookups per 24 hours but you can increase them to 150,000 free lookups for 24 hours by Enabling Billing in Google Cloud Console.


1 Answers

You have just to add in your input html: placeholder=""

like image 82
Greencame Avatar answered Oct 11 '22 03:10

Greencame