Hello again!
I am modifying a wordpress plugin. I have been tasked with simulating a click event
to a <select>
menu . The idea is when user searches an address a simulated click will open the radius select menu.
This works as expected on desktop, but I can’t make it work on any mobile devices. Can you help.
Here is the code.
I have tried trigger(“touchstart”) and click() neither will work.
$( "#wpsl-search-input" )
.change(function() {
var isSearch = $("#wpsl-search-input").val();
var radiusSelected = 0;
if($("#wpsl-radius span.wpsl-selected-item").attr("data-value")) {
radiusSelected = parseInt($("#wpsl-radius span.wpsl-selected-item").attr("data-value"))
} else {
radiusSelected = parseInt($("#wpsl-radius-dropdown").val());
}
if(isSearch && radiusSelected === 0 && !checkMobileUserAgent()) {
$("#wpsl-radius span.wpsl-selected-item").click();
} else {
var btn = $("#wpsl-radius").click()
}
})
})