I'm developing a program where you have a drop down menu happy with the Monthly, Weekly or Daily values that are the periodicity in which a system task should be run. Ai has a second drop down menu that should contain options according to what was chosen in the first one. If it is monthly, it displays from 0 to 31, weekly displays from Sunday to Saturday and daily is empty.
I had done this with divs, but when making changes (even using a remove () function in JS to clear the list) it was only managing to change from weekly to monthly, when the opposite was done, the day of the week did not was changed in any way, even the drop down values being correct.
Oh my boss suggested doing it in another way that is not even working which is what is below. Anyone have suggestions or can you point me to the errors please?
Script and HTML below
<style type="text/css" media="all">
@import url("http://www.'.$_SESSION['p_url'].'css/cs_style_frm.css");
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script><scripttype="text/javascript">
$(document).ready(function () {
$("#tipoPeriodo").change(function() {
$( "option", "#diaPeriodo" ).remove()
if ($(this).val() == "m") {
for (var i=1; i<=31; i++){
$(#diaPeriodo).html = ("<option value="+i+">+i+<option>");
}
}
if ($(this).val() == "s"){
$("#diaPeriodo").html("<option value="1">Segunda-feira</option>");
$("#diaPeriodo").html("<option value="2">Terça-feira</option>");
$("#diaPeriodo").html("<option value="3">Quarta-feira</option>");
$("#diaPeriodo").html("<option value="4">Quinta-feira</option>");
$("#diaPeriodo").html("<option value="5">Sexta-feira</option>");
$("#diaPeriodo").html("<option value="6">Sábado</option>");
$("#diaPeriodo").html("<option value="7">Domingo</option>");
}
if ($(this).val == "d"){
$("#diaPeriodo").html("<option value="0"> </option>");
}
});
});
</script>'
<label>Dia de Execução <label><br />
<select style="width:150px;" id="diaPeriodo" name="diaPeriodo"></select><br />