You need to bind the change function in the "success" function, after
"#jumpMenu2" is actually loaded and inserted into the DOM:
...
  success: function(html) {
    $("#department_select").html(html);
    // #jumpMenu2 now exists so you can do things to it
    $("#jumpMenu2").change(function() {
      var z = $(this).val();
      alert(z);
    });
  },
...

Karl Rudd

On 9/27/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> i'm creating a search interface based on select dropdown methods.. the
> user selects the option from the first menu and the second is created
> dynamically using ajax. their is a third option which will be
> populated based on their selection of the second dropdown. however
> this does not work... seems the onchange method isn't workin? any
> ideas guys? here's a snippet of my code
>
> <!-- ajax requests for category search -->
>                 $("#jumpMenu").change(function()
>                 {
>                         var x = $(this).val();
>                         $.ajax({
>                                 type: "GET",
>                                 url: 
> "/bookstore/includes/israel_mod/ajax.php",
>                                 data: "type=division&catId=" + x,
>                                 dataType: "html",
>                                 success: function(html){
>                                 $("#department_select").html(html);
>                                 },
>                                 error: function(msg){
>                         alert( "An Error: " + msg );
>                                 }
>                         });
>                 });
>
>                 $("#jumpMenu2").change(function()
>                 {
>                         var z = $(this).val();
>                         alert(z);
>
>                 });
>
> NOTE: #jumpMenu2 is the second dropdown that doesn't seem to be taking
> the change event (i put a test alert, but it doesn't work), this is
> also the dynamically generated select .. would it be .. because it is
> appended into the html? any ideas
>
> thanks a lot, this has me wtih a massive migraine, can't figure out
> why it wouldn't accept the onchange funchtion
>
> Israel
>
>

Reply via email to