为什么jQueryUI不会运行?

0 javascript jquery jquery-ui

这是一个WP安装,它已经安装了jQuery核心,如下所示:

<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js?ver=1.3.2'></script>
Run Code Online (Sandbox Code Playgroud)

我想利用:

http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/jquery-ui.min.js

我试过把它装在体内像这样:

<div id="diag1">Step1</div>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/jquery-ui.min.js">

  alert("I'm alive"); // nope it's dead
  jQuery("#diag1").dialog({modal: true});

</script>
Run Code Online (Sandbox Code Playgroud)

即使我在页面中发出警报,这也没有任何作用.

我试过了

  • 将脚本链接也放在页面的头部.
  • 安装第三方插件,我知道使用jqueryui,这没有任何作用.

我已经证实了

  • 当我去view-> source时,在jquery之后加载jqueryui
  • jqueryui与jquery兼容

我还可以做些什么?

我知道wordpress有一个用于加载脚本的自定义php函数,但我不知道它的作用或它如何影响脚本的可用性.我尝试过使用它仍然没有去.

http://codex.wordpress.org/Function_Reference/wp_enqueue_script

我只想用jQueryUI开发一个模态.最后,我正在努力做到这一点:

对于本网站:

www.papermepress.com

Dav*_*gan 5

您不应该在脚本块之间放置任何内容,因为您需要关闭对jQuery UI的引用.所以....

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/jquery-ui.min.js">
Run Code Online (Sandbox Code Playgroud)

应该

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/jquery-ui.min.js"></script>
<script type="text/javascript">

  alert("I'm alive"); // nope it's dead
  jQuery("#diag1").dialog({modal: true});

</script>
Run Code Online (Sandbox Code Playgroud)