-1
<script>
function check(){
var verificaInput = document.querySelector("#cidade").value;
var reg = /^[0-9]{4}$/;
console.log(reg.exec(verificaInput))
console.log(reg.test(verificaInput))
}
function changecidades(){
var selectedoption = document.getELementById(optionvalue)
console.log(changecidades())
for(i = 0, i < selectedoption, i++){
}
}
</script>
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>test</title>
</head>
<body>
<label>
<select id="optionvalue" onchange="changecidades(this.value);">
<option value= "0">São Paulo</option>
<option value="1">Jundiaí</option>
<option value="2">Casa Branca</option>
<option value="3">Campinas</option>
<option value="4">Sorocaba</option>
</select>
<br>
<input type="number" name="agencia" id="cidade"/>
<br>
<input type="number" name="conta" id="id"/>
<br>
<input type="button" value="click to check" onclick="check(this.id)"/>
</label>
</body>
</html>
Hey, guys, good night! Please, as you would go through the select option and check a Regex of 2 numbers between 0-9 for each city, I stopped at the for.
Thank you.
What do you mean "two-digit regex"? That means that the values can only have exactly two digits, or it is at most two?
– hkotsubo