Thom
Thom

Reputation: 1

jQuery Live for drop box selection (change)

I'm having a problem getting content loaded into a document to fire jQuery scripts.

I have the following code

$(".jquery-selectbox").change(function(e) {
                url = this.options[this.selectedIndex].value;
                $('#pane2').fadeOut(500, function () {
                    $('#pane2').fadeIn(500);
                    $("#pane2").load(url, '', reinitialiseScrollPane2);
                });
});

that should cause a drop box to load a link based on the value selected. The drop down box is loaded into the page on document ready via jQuery's .load. It has a class of '.jquery-selectbox'

I tried to follow the jQuery documentation on .live based on 'change' but it wouldn't work for me, even after updating to 1.4.2. What should I do to make this work?

Thanks!

Upvotes: 0

Views: 3507

Answers (1)

Alpesh
Alpesh

Reputation: 5405

Try this -

$(".jquery-selectbox").live('change',function(e) {
                var url = $(this).val();
                $('#pane2').fadeOut(500, function () {
                    $('#pane2').fadeIn(500);
                    $("#pane2").load(url, '', reinitialiseScrollPane2);
                });
});

Upvotes: 2

Related Questions