Skip to content

Instantly share code, notes, and snippets.

@chrislkeller
chrislkeller / README.md
Last active January 27, 2023 16:26
Convert string Lat/Long to number for Google Maps API.

Convert string Lat/Long to number for Google Maps API

When sending Lat/Long values to the Google Maps API for something like setCenter(), it wants an number value. But the value we pull from an option menu like the one below is a string.

<select id="searchString" onchange="zoomToAddress(this.value);">
<option value="">--Select All--</option>
<option value="43.138092,-89.747988">Luckenbooth Cafe</option>
<option value="43.017218,-89.831479">Aunt Mary's Hooterville Inn</option>
</select>