Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps v3, custom control with textbox: can't perform input

I am trying to add a custom control to my google map (v3): I want to have search box just near the other map controls. So I add a div with <input type="textbox"> on it, and it's being shown on the map. But the problem is that the textbox is inaccessible: I can't type anything inside it, or even focus on it.

function SearchBox() {
    var searchTextBox = $('<input type="text" id="txtGeoSearch" />');

    var div = $('<div class="geoSearchBox"></div>')
        .append($('<span>Search:</span>'))
        .append(searchTextBox);

    return div.get(0);
}

// inside init()
geoMap.controls[google.maps.ControlPosition.TOP_LEFT].push(new SearchBox());

So what should I do to make my textbox behave like normal one?

like image 255
Mike Sviridoff Avatar asked Mar 16 '10 19:03

Mike Sviridoff


People also ask

What are the user interface controls available in Google Maps?

Default Controls This slider will be located at the corner of left hand side of the map. Pan − Just above the zoom slider, there will be a pan control for panning the map. Map Type − You can locate this control at the top right corner of the map. It provides map type options such as Satellite, Roadmap, and Terrain.


1 Answers

Works for me: http://jsfiddle.net/cFpkt/

like image 110
dave1010 Avatar answered Sep 23 '22 05:09

dave1010