views:

51

answers:

2

I have a jQuery colorbox opened over top of my webpage (with a <select> drop down list) and I'd like to make an AJAX call every time a new <option> is selected from the drop down.

I have the following code, but it's not picking up the select event.

$('#cboxLoadedContent select[name=parent]').live('select', function() {
  $.get("edit.php", { fn: 'getFormatLevel', parent: $('select[name=parent]').val() }, function(data) {
    alert("Data Loaded: " + data);
  });
});

Any ideas why this isn't even recognizing my selector?

+1  A: 

I am not sure 'select' is an event you might want to try 'change' or 'click' instead.

matpol
+3  A: 

Does a select event exist? I think it has to be change:

$('#cboxLoadedContent select[name=parent]').live('change', function() {
   $.get("edit.php", { fn: 'getFormatLevel', parent: $(this).val() }, function(data) {
        alert("Data Loaded: " + data);
   });
});
Felix Kling
That's totally my problem. I thought 'select' was a valid event--my bad.
thinkswan