Use JQuery in Ossn.MessageBox(action)

Dani MR Posted in Beginning Developers 9 years ago

Hi,

I trying to use inside MessageBox but don't working, the code its like this.

> Ossn.RegisterStartupFunction(function(){
$(document).ready(function(){

  $('#ossn-add-trip').click(function(){   
      Ossn.MessageBox('trip/add');  //Show the form, here I need to use some js
       if($("#place").length){ //Input in the form but never exist the input
        alert("exist");
      }  
});
  if($("#place").length){ ////Input in the form but never exist the input
        alert("exist");
  }

  $('#ossn-trip-submit').click(function(){  //Action in form
      Ossn.MessageBox('trip/add');
  }); 

});

The form showing properly.

Any idea?

Thanks

Replies
Spanish Dani MR Replied 9 years ago

Sure!

I need include this code:

<script type="text/javascript">

        function init() {
            var input = document.getElementById('place');
            var autocomplete = new google.maps.places.Autocomplete(input);
        }

        function getLatLong(){
         var geocoder = new google.maps.Geocoder(); //Instancia Geolocalització
         var address = document.getElementById("place").value;
         //alert(address);

         geocoder.geocode( { 'address': address}, function(results, status) {
            if (status == google.maps.GeocoderStatus.OK) {

                var latitude = results[0].geometry.location.lat();
                var  longitude = results[0].geometry.location.lng();
                 alert('La longitud es: ' + longitude + ', la latitud es: ' + latitude);

            } 
          });
        }

        google.maps.event.addDomListener(window, 'load', init);

    </script>

The code is for autocomplete input with Google Maps API

Example: https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete

Indonesian Arsalan Shah Replied 9 years ago

Can you explain what you really trying to achieve?