开发者

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()开发者_如何学JAVA
geoMap.controls[google.maps.ControlPosition.TOP_LEFT].push(new SearchBox());

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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜