Hi can anyone tell me why remove() is not working in the following code
$("#mydropdown_for_month").change(function(){
$("#mydropdown_for_day").empty();
for (var i=1; i<=31; i++)
{options += '<option>' + i+'</option>';}
$('#mydropdown_for_day').after().html(options);
I have two select boxes with ids mydropdown_for_month and mydropdown_for_day. The problem is that when I click any month in the first dropdown , second dropdown normally shows all the dates from for loop as i have mentioned but when i again change the month say from feb to april the second dropdown show dates from 1 to 31 twice (may be 1 to 31 for first i select month and 1 to 31 again for the second time when i select april). so to solve this i put the following statement $("#mydropdown_for_day").empty(); so that on every selection from the first dropdown , second dropdown’s all previous options get removed but no use.
Please help me where am i making mistake?
If you want to remove all options you could use: