1
 $("#body_content").dialog({
            title: "AAAa",
            modal: true,
            width:'auto',
            height:'auto',
            resizable:false,

            open: function(){

                var id = $('#right_button').attr('id');
                var lat = $('#right_button').attr('lat');
                var lng = $('#right_button').attr('lng');
                var body_text = $('#body_content').attr('body_text');


                $("#body_content").html(body_text); //this is the line that "breaks" the script
                if (lat != "" && lng!=""){

                if (map == null) {
                    var myOptions = {
                        zoom: 14,
                        center: new google.maps.LatLng(lat, lng),
                        mapTypeId: google.maps.MapTypeId.ROADMAP
                    };
                    var latLng = new google.maps.LatLng(lat,lng);
                    map = new google.maps.Map(document.getElementById('map_dialog'), myOptions);

                    var marker;
                    marker = new google.maps.Marker({
                        position: latLng,
                        map: map
                    });
                }


            }
                else {
                    $('#map_dialog').hide();
                }
                }

In my code I am trying show content and map into dialog, but when I use $("#body_content").html(body_text); the map donesn't appear, so when I remove this line, the map apears what is the problem here

4
  • 1
    Does your #note_content element really have a body_text-attribute? This is probably not defined, therefore you cannot use it as html for #body_content Commented Apr 28, 2012 at 10:06
  • 1
    What do you mean by "fix this"? Do you get an error in your JS console? What are you trying to access when calling $('#body_content').attr('body_text'); Commented Apr 28, 2012 at 10:10
  • I think you should share also your html Commented Apr 28, 2012 at 10:17
  • var body_text = $('#body_content').attr('body_text'); does your markup of body_content have attr body_text. Because it's not a standard attribute. Commented Apr 28, 2012 at 10:20

1 Answer 1

1

I think you have to look your div in your html and maybe this can help you how to set content on Jquery dialog

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.