从Google自动填充中删除国家/地区名称

时间:2018-02-26 13:48:29

标签: javascript jquery

我希望将此自动填充仅限于一个特定国家/地区(我使用componentRestrictions: {country: 'br'}向巴西执行此操作),但我不希望每个搜索查询都显示该国家/地区的名称(就是这样)对用户来说很明显)。

enter image description here

我试过这个js函数:

$('.pac-item span:nth-child(3)').contents().filter(function() {
    return this.nodeType == 3
}).each(function(){
    this.textContent = this.textContent.replace('Brazil','');
});

此功能仅适用于浏览器控制台,仅适用于一次(我不知道原因)。

如果我通过css制作:

.pac-item span:nth-child(3){
   display: none !important;
}

在这种情况下,问题是它删除了国家/地区的州,我想显示城市+州。

0 个答案:

没有答案
相关问题