title: jquery-ui.js:12443 Uncaught TypeError: Cannot read property 'apply' of undefined
body: <p>I have written this code in my project and it is displaying the error:<br></p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'apply' of undefined</p>
  </blockquote>
  
  <pre class="lang-html prettyprint-override"><code>if (TempData["notice"] != null)
  {
      &lt;link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" type="text/css"&gt;
      &lt;script src="https://code.jquery.com/jquery-1.12.4.js"&gt;&lt;/script&gt;
      &lt;script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"&gt;&lt;/script&gt;
      &lt;p id="dialog" style="color:red"&gt;
          @TempData["notice"]&lt;br /&gt;
          &lt;button id="bclose"&gt;Ok&lt;/button&gt;
      &lt;/p&gt;
      &lt;script language="javascript"&gt;
          $('#dialog').dialog({
            dialogClass: "no-close",
            buttons: [{
              text: "Ok",
              Click: function() {
                $('#dialog').dialog('close');
              }
            }]
          });
      &lt;/script&gt;
  }
  </code></pre>
  
  <p>DO I need to add any library for the above code</p>