McFly
McFly

Reputation: 173

jQuery Dialog Box To Fire Once Select Option Is Selected

I'm trying to open a dialog box once any option is selected from the dropdown list. Here is my jQuery:

$(document).ready(function() {

$( "#dialogbox" ).dialog({ modal: true, autoOpen: false }); 
    $( "#dropdown" ).selected(function() {
        $( "#dialog" ).dialog( "open" );
        $( "#dialogbox" ).toggle( "puff" );
    });
});

I think the problem is ".selected(function()" I've tried .change, .click, and none of them seem to fire the dialog box. I've been through the API documentation, but couldn't find how to do this for a dropdown. I'm new to this, and would appreciate any help.

Here is my fiddle

Upvotes: 0

Views: 640

Answers (1)

chyupa
chyupa

Reputation: 179

Try this:

$("#dropdown").change(function(){
    $("#dialogbox").dialog();
});

I suppose you have an element with #dialogbox id in your html somewhere otherwise the code won't show anything.

Upvotes: 1

Related Questions