JSFiddle - React, Tailwind, and code Playground
by Lucaskazama
HTML
<select id="form">
<option value="1">Plano 1</option>
<option value="2">Plano 2</option>
<option value="3">Plano 3</option>
</select>
<a href="#?plano=1#form">Plano 1</a>
JavaScript
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = window.location.search.substring(1),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return typeof sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
}
}
return false;
};