I make a website on NetCat where a Yandex map is needed, but not simple - when clicking on a map, a balun should pop up with a form where information should be entered, among which there should be a line for entering the time in the hh: mm: ss format.

I made the map and the opening balun, since there are examples on the Yandex website, I also put the form in there, but when I decided to connect the jQuery Timepicker Addon 0.5 plug-in, there was a problem - this plug-in does not want to work inside the map script. Although if you just use it on the component page, then everything works. I appeal to you for help.

Here is the code of my card with the form and attempt to connect the plugin:

// Как только будет загружен API и готов DOM, выполняем инициализацию ymaps.ready(init); function init () { var myMap = new ymaps.Map('map', { center: [55.790833, 49.114444], // Красное-на-Волге zoom: 11 }, { balloonMaxWidth: 250 }); // Обработка события, возникающего при щелчке // левой кнопкой мыши в любой точке карты. // При возникновении такого события откроем балун. myMap.events.add('click', function (e) { if (!myMap.balloon.isOpen()) { var coords = e.get('coordPosition'); myMap.balloon.open(coords, { contentHeader: 'Новая контрольная зона', contentBody: '<form id=formadd action=/template/control_zones/outpoint.php method=post target=_self>'+ 'Устройство к которому будет добавлена контрольная зона :'+ ' "; $res_devicesList = mysql_query(" SELECT * FROM `siteonfly_tracker`.`Message113` WHERE `User_ID` = '$current_user[User_ID]' "); $result .='<select name="deviceID" size="1" >'; while($list = mysql_fetch_assoc($res_devicesList)) { $result .= '<option value="'.$list[DeviceID].'">'.$list['Name'].' '.$list[DeviceID].'</option>';//Device_ID } $result .= '</select>'; $res_phone = mysql_query(" SELECT `Phone` FROM `siteonfly_tracker`.`User` WHERE `User_ID` = '$current_user[User_ID]' "); $phone_sel = mysql_fetch_assoc($res_phone); $phone = $phone_sel['Phone']; $result.=" '+ 'Название :<input type=text name=namepoint><br>'+ 'Радиус :<input type=text name=radiuspoint><br>'+ ' "; $result .='<input type="text" name="testTime" style="width: 70px;" id="timepickerTestInMap" value="" />'; //$result .='<script type="text/javascript">'; $result .=' $(document).ready(function() {'; $result .=' $("#timepickerTestInMap").timepicker();'; $result .=' });'; //$result .=' </script>'; $result .=" '+ ' "; $result .= 'Время начала контроля (чч:мм:сс) :<input type="text" name="begintime" style="width: 70px;" id="timepickerBegin" value="">'; $result.=" '+ ' "; $result .= '<br>Время окончания контроля (чч:мм:сс) :<input type="text" name="endtime" style="width: 70px;" id="timepickerEnd" value="">'; $result.=" '+ '<input type=submit name=submit_cz >'+ '<input name=pcoord type=hidden value='+coords[0].toPrecision(6)+';'+coords[1].toPrecision(6)+' />'+ '<input name=phone type=hidden value=$phone />'+ '</form>', contentFooter: '<p>Координаты контрольной зоны: ' + [ coords[0].toPrecision(6), coords[1].toPrecision(6) ].join(', ') + '</p>' }); } else { myMap.balloon.close(); } }); // Обработка события, возникающего при щелчке // правой кнопки мыши в любой точке карты. // При возникновении такого события покажем всплывающую подсказку. myMap.events.add('contextmenu', function (e) { myMap.hint.show(e.get('coordPosition'), 'Кто-то щелкнул правой кнопкой'); }); //управление картой myMap.behaviors.enable('scrollZoom') // Добавление стандартного набора кнопок myMap.controls.add('mapTools') // Добавление кнопки изменения масштаба .add('zoomControl') // Добавление списка типов карты .add('typeSelector'); } 

as you can see, I first tried to shove the script into the script, but then when meeting the internal </script> external script of the map was closed, so I commented out this place, but now the code for calling the plugin function crawls out of the page.

PS for those who do not know - in NetCat php code is inserted using this construct "; *[php код]* $result.=" , Where everything

 `echo '';` 

need to be replaced by


    1 answer 1

      $result .='<script>'; $result .=' $(document).ready(function() {'; $result .=' $("#timepickerTestInMap").timepicker();'; $result .=' });'; $result .=' </script>'; 

    try it without javascript type

    • one
      ugorau =))) - Palmervan
    • @Palmervan you look at his previous answers. There, in one of them, a person did not ask to minus this comrade for his inexperience back in April of that year. It's also fun how to watch video reviews from Misha Taburetkin: D - lampa
    • @lampa yes I am amused only today) - Palmervan
    • did not help ( - bazanski
    • @lampa and I also asked him about the DOM (first) not to be minus :) - Rules