0
Good afternoon guys. See if you can help me with something.
I need to generate a data list. Manufacturing Year and Model Year.
I did it this way:
var i;
for (i = new Date().getFullYear(); i >= 1900; i--)
{
$('#ano_fabricacao').append("<option value="+i+">"+i+"</option>");
$('#ano_modelo').append("<option value="+i+">"+i+"</option>");
}
$('#ano_fabricacao').change(function() {
var ano = $(this).val();
$('#ano_modelo').find('option').remove();
$('#ano_modelo').append('<option value="">Até</option>');
for (i = new Date().getFullYear(); i >= ano; i--)
{
$('#ano_modelo').append("<option value="+i+">"+i+"</option>");
}
});
When selecting the year of manufacture, in the year of the model appears only the following years. Example: I selected 2018 in manufacturing and the model year appears only, 2018, 2019 and 2020 which are the following years. That’s all well and good. But I would like a change. When selecting the year 2015 (in manufacturing) I would like it to appear only 2015 and 2016 (in model). It would only be the following year.
Someone can help?
Truth @Leandrade don’t know why I put that other one inside the change. But thanks for the help. It helped a lot!
– Saulo
Cool that helped man, success!
– LeAndrade