那么,制作一个表单有多于1个地址的搜索框。 使用jquery google自动完成地址搜索。 与这个jQuery插件: ubilabs.github.io/geocompletejquery帮助需要 - 只把数据放在同一格下
试图让细节数据,这样不同的输入框: ubilabs.github.io/geocomplete/examples/form.html
$(".addressinputclass").geocomplete({
details: ".thisisparentclass",
detailsAttribute: "data-geo"
});
这是HTML:
<div class="thisisparentclass">
<input type="text" name="address1" class="addressinputclass" />
<input type="text" name="writepostcodehere" placeholder="Post code" data-geo="postal_code" />
<input type="text" name="writecountryhere" placeholder="Country Name" data-geo="country" />
</div>
,但现在的问题,当它是多个地址输入b牛,其他信息框获取最后的地址信息。 你可以在这里查看示例: http://jsfiddle.net/kosmspLm/
有帮助吗?
更新: 感谢来自Lesha Ogonkov &图沙·古普塔的帮助。 我得到了我的问题的解决方案。 :)
哇!我尝试使用$(this).closest(“。thisisparentclass”),但它没有成功,没有考虑每个循环。非常感谢代码。 – crazymoin 2014-10-01 05:18:05
@crazymoin很高兴帮助:) – 2014-10-01 05:21:47