首先转到此链接http://www.enjoyholistic.com/event/search 并填写搜索表单并单击搜索,然后在邮政编码文本框中输入london。
如果我转到活动详细信息屏幕并返回搜索,则不会填充该位置。如果我点击位置框 - 邮政编码,城镇,城市搜索。 它神奇地出现了。
我将使用下面的代码填充文本框。
(function ($) {
$.QueryString = (function (a) {
if (a == "") return {};
var b = {};
for (var i = 0; i < a.length; ++i) {
var p = a[i].split('=');
if (p.length != 2) continue;
b[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " "));
}
return b;
})(window.location.search.substr(1).split('&'))
})(jQuery);
$("input[name='eventPostCode']").val($.QueryString["eventPostCode]);
它可以在chrome中工作,但在firefox中不起作用...
答案 0 :(得分:0)
似乎javascript或者firefox的性质有问题,当它返回按钮时,places-api没有得到通知。
我找不到关于如何执行此操作的文档,但我认为一种解决方法可能是将焦点更改为自动填充文本框的位置。
您可以使用document.getElementById("autocomplete-text-box").focus();
和document.getElementById("autocomplete-text-box").blur();