我已经设法找出如何将数据从 excel 文件中提取到 HTML 中。
我现在正在尝试查看如何在一组单元格中搜索值。有谁知道如何实现这一目标?
提前致谢!
我需要一些有关Google Maps API以及使用自动填充和地址完成的帮助.
这是我目前的代码:
JS
function fillInAddress(show) {
console.log(show);
var place = autocomplete.getPlace();
for (var i = 0; i < place.address_components.length; i++){
var base = place.address_components[i].types[0];
if(base === "postal_code"){
console.log(place.address_components[i].long_name);
}
}
}
function initialize(out) {
autocomplete = new google.maps.places.Autocomplete(
(document.getElementById(out)),
{types: ['geocode']});
google.maps.event.addListener(autocomplete, 'place_changed', function () {
fillInAddress(out);
});
}
initialize("from");
initialize("to");
Run Code Online (Sandbox Code Playgroud)
HTML
<input type="text" id="from" class="location">
<input type="text" id="to" class="location">
<input id="fromPc" type="text">
<input id="toPc" type="text">
Run Code Online (Sandbox Code Playgroud)
地点下拉列表工作正常,允许您输入,然后将提出建议.
但是当我点击from输入中的一个建议时,我在控制台中收到此错误.
Uncaught TypeError: Cannot read property 'address_components' of undefined
Run Code Online (Sandbox Code Playgroud)
但是,当我在"输入"框中执行此操作时,它可以正常工作并返回邮政编码.
如果我然后返回第一个输入"from"然后再次输入地址,它会返回一个邮政编码,但它会从第二个输入"to"返回邮政编码. …
我试图根据他们的数据属性过滤我的列表项.请参阅下面的代码:
HTML
<li data-process="test 1 ; test 2 ; test 3;">Item</li>
<li data-process="test 2 ; test 3;">Item</li>
<li data-process="test 1 ; test 2 ; test 3;">Item</li>
<li data-process="test 2 ; test 3;">Item</li>
<li data-process="test 1 ; test 2 ; test 3;">Item</li>
Run Code Online (Sandbox Code Playgroud)
JS
$('[data-process="test1"]').hide();
Run Code Online (Sandbox Code Playgroud)
那么我希望所有带有测试1的项目都隐藏起来.
提前致谢!