vendredi 20 mars 2015

jQuery .change() isn't firing as expected for a dropdown list, and I can't see why

I am having some trouble spotting why my jQuery function isn't working as expected. The goal is to send an ajax call to the server when a dropdown changes, which will update the fields in the next half of the form: Example of the form


With the extraneous functions removed, my jQuery looks like this:



$(document).ready(function(){
//Re-Load the form when a new game type is selected
$("#meta_game_type_dropdown").change(function(){
alert('woop');
$.post('http://ift.tt/1MSytYM',
{
game_type: $('#meta_game_type_dropdown').val(),
},
function(data, status){
$('#match_form').html(data);
$('.numeric_only').forceNumeric();
//Set the default time to the current time
$('#meta_time_input').setNow();
});
});
});


However, I'm not even getting the woop alert when I change the dropdown. I have confirmed that the id is correct:



<select name="game_type" id="meta_game_type_dropdown">


So I'm stumped now. Any ideas are appreciated.


Aucun commentaire:

Enregistrer un commentaire