Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: TypeError: $(...).dialog is not a function

I am having an issue getting a dialog to work as basic functionality. Here is my jQuery source imports:

<script type="text/javascript" src="scripts/jquery-1.9.1.js"></script> <script type="text/javascript" src="scripts/jquery-ui-1.11.1.js"></script> <script type="text/javascript" src="scripts/json.debug.js"></script> 

Html:

<button id="opener">open the dialog</button> <div id="dialog1" title="Dialog Title" hidden="hidden">I'm a dialog</div>  <script type="text/javascript">     $("#opener").click(function() {             $("#dialog1").dialog('open');     }); </script> 

From the posts around seems like as a library import issue. I downloaded the JQuery UI Core, Widget, Mouse and Position dependencies.

Any Ideas?

like image 330
mzereba Avatar asked Sep 24 '14 12:09

mzereba


1 Answers

Be sure to insert full version of jQuery UI. Also you should init the dialog first:

$(function () {    $( "#dialog1" ).dialog({      autoOpen: false    });        $("#opener").click(function() {      $("#dialog1").dialog('open');    });  });
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>     <script src="https://code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script>    <link rel="stylesheet" href="https://code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css" />    <button id="opener">open the dialog</button>  <div id="dialog1" title="Dialog Title" hidden="hidden">I'm a dialog</div>
like image 199
dashtinejad Avatar answered Sep 19 '22 15:09

dashtinejad