I want to use an option to change the query on the end of a URL to change it sorting options Ex:
& lt; Select ID = "Sort" & gt; & Lt; Option value = "? Order_b = date" & gt; Recent & lt; / Options & gt; & Lt; Option value = "? Order_by = Random" & gt; Popular & lt; / Option & gt; & Lt; Option value = "? Order_by = Random" & gt; Random & lt; / Option & gt; & Lt; Option value = "" & gt; Staff Picks & lt; / Option & gt; & Lt; / Select & gt; By default, a list of posts will be shown for the dates according to the date and then if a user chooses an option, then it will return the page along with the query string at the end of the URL. Will load. It is possible to use jQuery to achieve this if possible. Thank you.
After adding the value of the selected option, attach a handler for the event to select everything after For current window space with? ('Option: selected'). Val (), locSnip = Window.location.href.split ('?') [0]; Window.location.href = locSnip + move;});
(This does not redirect, but you get this idea ...)
To select an appropriate value on page load, you can run Before you tie the handler to the change:
select the functionResort () {var match = window.location.href.split ('?') [1]; . $ ('#include') ('option [value $ =' '+ match +' "] 'seems to be attr (' selected ', true). } Select Resource ();
Comments
Post a Comment