Hay 3 formas:
Con JavaScript (uso de Cookies o localStorage):
Código Javascript
:
Ver originalvar val = window.localStorage && typeof localStorage["elValor"] != "undefined" ? localStorage["elValor"] : "valorDefecto";
$("#select").val(val).change(function(){ localStorage["elValor"] = $(this).val()})
Con HTML a través del formulario con parámetros GET y JavaScript
:
Código Javascript
:
Ver originalfunction getParameterByName(name) {
//http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
$("#select").val(getParameterByName("selectValor"));
Con PHP.