Skip to content

Instantly share code, notes, and snippets.

@nikosantis
Created May 10, 2022 12:46
Show Gist options
  • Save nikosantis/76358369000941b661c5cc97fc11aae5 to your computer and use it in GitHub Desktop.
Save nikosantis/76358369000941b661c5cc97fc11aae5 to your computer and use it in GitHub Desktop.
// use a searchParam for preselect unit
// for example here https://cotizador.saladeventasdigital.com/cotizador/index.php?id_subagrupaciones=22&key=idea&portal=&open_dialog=true&unit=87
// we have 86, 88, 89, 76, 77, 85, 87 and 90 units (modelos)
// we can preselect unit with javascript
var queryStrings = window.location.search;
var params = new URLSearchParams(queryStrings);
var unit = params.get("unit")
if (unit) {
document.getElementById("modelos").value = unit
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment