0
I’m trying to use the jquery mask, I’ll use it a < input > added by javascript by the action of selecting a < option >.
<script src="jquery-1.5.2.min.js"></script>
<script src="jquery.maskedinput-1.3.min.js"></script>
<select name="opcao" id="sel" onchange="muda()" class="form-control">
<option value="option1">option1</option>
<option value="option1">option1</option>
</select>
<div class='col-sm-9 text-left' id="rdo">
</div>
<script type="text/javascript">
function muda() {
if (document.getElementById("sel").value == "option1") {
document.getElementById('rdo').innerHTML =
"<div class='form-group'><label class='col-sm-2' for='dia' control-label>Dia</label><div class='col-sm-9'><input class='form-control' type='date' name='dia' id='dia' required autofocus></div></div>" +
"<div class='form-group'><label class='col-sm-2' for='hora' control-label>Hora</label><div class='col-sm-9'><input class='form-control' type='time' name='hora' required></div></div>" +
"<div class='form-group'><label class='col-sm-2' for='local' control-label>Local</label><div class='col-sm-9'><input class='form-control' size='251' maxlength='250' type='text' name='local' required></div></div>" +
"<div class='form-group'><label class='col-sm-2' for='endereco' control-label>Endereço</label><div class='col-sm-9'><input class='form-control' maxlength='500' type='text' name='endereco' required></div></div>" +
"<div class='form-group'><label class='col-sm-2' for='obs' control-label>OBS</label><div class='col-sm-9'><input class='form-control' maxlength='500' type='text' name='obs'></div></div>";
} else {
document.getElementById('rdo').innerHTML = "";
}
}
</script>
<script>
jQuery(function($) {
$("#dia").mask("99/99/9999")
});
</script>