Sorting 选择sortby add selected on multiple page with javascript

Sorting 选择sortby add selected on multiple page with javascript,sorting,select,selected,Sorting,Select,Selected,我正在使用这个脚本 $("#select_sortby option").each(function() { $(this).val() === window.location.toString() && $(this).prop("selected", !0) }); 但只适用于一页,我还需要wordpress上的第/2页/3页 <li class="dropdown sortby"> <s

我正在使用这个脚本

$("#select_sortby option").each(function() {
    $(this).val() === window.location.toString() && $(this).prop("selected", !0)
});
但只适用于一页,我还需要wordpress上的第/2页/3页

<li class="dropdown sortby">
<select class="dropdown-toggle" data-toggle="dropdown" tabindex="-1" id="select_sortby" onchange="if (this.value) window.location.href=this.value">
<option value="http://localhost/finale/">Recently Added</option>
<option value="http://localhost/finale/rating/">Most Rated</option>
<option value="http://localhost/finale/?orderby=years&order=ASC">Release Date &darr;</option>
<option value="http://localhost/finale/?orderby=years&order=DESC">Release Date &uarr;</option>
<option value="http://localhost/finale/?orderby=title&order=ASC">Title A to Z</option>
<option value="http://localhost/finale/?orderby=title&order=DESC">Title Z to A</option>
</select>
</li>
http://localhost/finale/page/2/?orderby=years&order=DESC