<script src="//api-maps.yandex.ru/2.0/?load=package.standard&lang=ru-RU" type="text/javascript"></script>
$(document).ready(function($) {
ymaps.ready(init);
function init() {
var geolocation = ymaps.geolocation;
if (geolocation) {
$text_city = geolocation.country + ', ' + geolocation.region + ', ' + geolocation.city;
//console.log($text_city);
$("#city0").val($text_city);
$("#city1").val($text_city);
$("#city2").val($text_city);
$("#city3").val($text_city);
$("#city4").val($text_city);
$("#city_call").val($text_city);
$("#city_modreserve").val($text_city);
$("#city_reserve").val($text_city);
} else {
console.log('Не удалось установить местоположение');
}
}
});
<button id="show">Показать на карте</button>
<div id="map" style="width: 300px; height: 300px"></div>
ymaps.ready(init);
var myMap;
function init(){
myMap = new ymaps.Map ("map", {
center: [55.76, 37.64],
zoom: 7
})}
var el = document.getElementById("show");
el.addEventListener("click", showBal, false);
function showBal(){
myMap.balloon.open(myMap.getCenter(), { content: 'Hello Yandex!' }, { closeButton: true });
}