JSFiddle - React, Tailwind, and code Playground
by Eric Miller
HTML
<form action="index.php" method="post">
<p class="clearfix">
<label>Sort by</label>
<select class="custom-select">
<option value="/index.php?action=searchresults&sortby=L_AskingPrice&sorttype=ASC&LM_char100_1_or[]=&LM_Int2_4[]=">Price</option>
<option value="/index.php?action=searchresults&sortby=LM_Int1_1&sorttype=ASC&LM_char100_1_or[]=&LM_Int2_4[]=">Bedrooms</option>
<option value="/index.php?action=searchresults&sortby=LM_Int1_2&sorttype=ASC&LM_char100_1_or[]=&LM_Int2_4[]=">Baths</option>">Bathrooms</option>
<option value="/index.php?action=searchresults&sortby=LM_Int4_19&sorttype=ASC&LM_char100_1_or[]=&LM_Int2_4[]=">Sq. Foot</option>
<option value="/index.php?action=searchresults&sortby=LM_Char10_18&sorttype=ASC&LM_char100_1_or[]=&LM_Int2_4[]=">Style</option>
</select>
</p>
</form>
JavaScript
; // prevent failover
(function($){
$(document).ready(function(){
$('.custom-select').on('change', function(e){
var self = this,
form = $(self).closest('form'),
val = $(self).val()
;
$(form).attr('action',val);
$(form).submit();
});
});
})(jQuery);