jquery dialog on button click

jquery, jquery-ui

Solution

This line

$(this).dialog('open');  // this here corresponds to the #opener div

supposed to be

$('#wrapper').dialog('open');

Also extra braces `});` .. Can be ignored if this is the closing brace for DOM Ready handler

Check Fiddle

Problem

I'm trying to get a jquery dialog to launch on a button click but does not seem to be working. Any help would be appreciated: ``` $('#wrapper').dialog({ autoOpen: false, title: 'Basic Dialog' }); $('#opener').click(function() { $(this).dialog('open'); return false; }); ``` ``` <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="https://code.jquery.com/ui/1.12.0/jquery-ui.min.js"></script> <button id="opener">Open the dialog</button> <div id="wrapper"> <p>Some txt goes here</p> </div> ``` Thanks!

Original source