Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4607918
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:46:14+00:00 2026-05-22T00:46:14+00:00

i use google map in my newest project ,and i have a combo box

  • 0

i use google map in my newest project ,and i have a combo box which contain a lot of places ,
this combo has two attributes(longitude,latitude) when my page loads i have function that plot markers for all places within this combo this function is here :

//Set All mohafzat markers
    function setMohMarkers(){
    //Loop Through mohafzat Combo
    $("#moh").each(function(i){
    //Remove Old Markers
            //clearOverlays();
            //loop Through it's Options
            $('option',this).each(function(i){
            var midx=$(this).index();
            if(midx==0){
                //Don't Plot 0 Index item

            }else{
            var idx=$(this).index();//get Current Index
            var lon=$(this).attr('lng');
            var lat=$(this).attr('lat');
            var mname=$(this).text();
            //point's On Map
            var myLatlng = new google.maps.LatLng(lat,lon);

            //put Marker
            var marker = new google.maps.Marker({
              position: myLatlng, 
              map: map, 
              icon:image,
             //animation: google.maps.Animation.BOUNCE,
              title:mname
              }); 


             google.maps.event.addListener(marker, 'click', function() {
                map.setZoom(10);
                map.setCenter(marker.latlng);
                //Set mohafzat Combo to selected Marker
                //$("#moh option:contains(" + marker.title +")").attr("selected","selected");
                $('#moh option:[text="' + marker.title + '"]').attr('selected', true);

                //Trigger Change Function

                $("#moh option:contains(" + marker.title +")").trigger('change');

                });
                //push marker To my array(help me of deleting them :D)
                Allmarkers.push(marker);
            }});
            //End Click Function
    });
    }

this code works very fine on internet explorer ,put with firefox when i click the marker for first time it zoom in to the selected place and if i have selected (index 0) of (select) tag it call this function to plot all places again and zoom out of map to show them all (till here every thing is fine) but if i have clicked the same marker again it do nothing ! don’t even put content of marker title at my combo box at this line :

$('#moh option:[text="' + marker.title + '"]').attr('selected', true);

what makes me nervous that this code works very will on IE !!!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T00:46:15+00:00Added an answer on May 22, 2026 at 12:46 am

    The attr property was changed in jQuery 1.6:
    See this question: .prop() vs .attr()

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application based on google map, in which I need to use
I have built an android app which use Google Map feature. I want my
How can use google map API to calculate the distance between two places based
I need to use the google map directions to show the directions between two
Which modules can I use to add a google map to a node with
I have made a mobile application that use Google static maps to get map
I have a view that contains a google map accessible via this.map within the
I'm hoping to use a Google Map in this way: User zooms in on
i want to use google chart map which is a piece of javascript code
I am using GWT for google map application. I use Google's gwt-maps.jar for mapping

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.