我可以在页面加载时自动将 span 类中的文本复制到输入字段,但我无法让 FacetWP 响应并更新结果,即使使用FWP.refresh()
https://facetwp.com/documentation/developers/javascript/facetwp-refresh/
刻面名称 -proximity
跨度类 -local-addrress-name
输入类 -facetwp-location
window.addEventListener('load', function () {
var nodes = document.querySelectorAll('.local-address-name');
var last = nodes[nodes.length- 1];
document.querySelector('.facetwp-location').value =last.innerHTML;
setTimeout(function() {
FWP.refresh(); // Change a facet value
console.log( "ready!" );
}, 2000);
});
<span class="local-address-name">Brunswick, GA, USA</span>
<input type="text" class="facetwp-location" value="" placeholder="Enter Zip or Address" id="facetwp-location" autocomplete="off">