【问题标题】:newbie in Jquery (including but no result)Jquery中的新手(包括但没有结果)
【发布时间】:2011-06-24 18:11:53
【问题描述】:

我有这个代码:

   <html>
<head>
<script type="text/javascript" src="js/jquery-ui-1.8.14.custom.min.js"></script>
<link type="text/css" href="css/themename/jquery-ui-1.8.14.custom.css" rel="Stylesheet" />  
<script type="text/javascript" src="js/jquery-1.4.4.min.js"></script>
<style>
    #feedback { font-size: 1.4em; }
    #selectable .ui-selecting { background: #FECA40; }
    #selectable .ui-selected { background: #F39814; color: white; }
    #selectable { list-style-type: none; margin: 0; padding: 0; width: 60%; }
    #selectable li { margin: 3px; padding: 0.4em; font-size: 1.4em; height: 18px; }
    </style>
    <script>
$(document).ready(function(){ $( "#selectable" ).selectable(); });

    </script>


</head>
<body>
<form method='post'>


<div class="demo">

<ol id="selectable">
    <li class="ui-widget-content">Item 1</li>
    <li class="ui-widget-content">Item 2</li>
    <li class="ui-widget-content">Item 3</li>
</ol>

</div><!-- End demo -->



<div class="demo-description" style="display: none; ">
<p>Enable a DOM element (or group of elements) to be selectable. Draw a box with your cursor to select items. Hold down the Ctrl key to make multiple non-adjacent selections. </p>
</div><!-- End demo-description -->
</form>
</body>
</html>

我下载了 jquery 但没有结果 我用过这个网站:

http://jqueryui.com/demos/selectable/#event-create

这里有什么问题?

【问题讨论】:

    标签: jquery-ui jquery-selectors


    【解决方案1】:

    你必须在 jQuery UI 之前嵌入 jQuery,因为 UI 使用 jQuery。

    <script type="text/javascript" src="js/jquery-1.4.4.min.js"></script>
    <script type="text/javascript" src="js/jquery-ui-1.8.14.custom.min.js"></script>
    <link type="text/css" href="css/themename/jquery-ui-1.8.14.custom.css" rel="Stylesheet" />  
    

    而不是

    <script type="text/javascript" src="js/jquery-ui-1.8.14.custom.min.js"></script>
    <link type="text/css" href="css/themename/jquery-ui-1.8.14.custom.css" rel="Stylesheet" />  
    <script type="text/javascript" src="js/jquery-1.4.4.min.js"></script>
    

    【讨论】:

    • 我也用过我改了包含错误我下载了不同的版本所以我重命名了它们
    【解决方案2】:

    您是否尝试将代码放在就绪函数中?

    $(document).ready(function() {
        // put all your jQuery goodness in here.
    });
    

    【讨论】:

    • $(function() { $( "#selectable" ).selectable(); });我把这个放在你的代码上没有结果
    【解决方案3】:

    试着把

    $(document).ready(function(){ $( "#selectable" ).selectable(); });
    

    &lt;head&gt;&lt;/head&gt; 元素内。 &lt;script src=".."&gt; 也应该在 &lt;head&gt; 中。

    【讨论】:

    • 好的,能不能用firefox,弄个firebug,看看Console有没有报错?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-10-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-23
    • 2017-06-06
    • 2015-05-09
    相关资源
    最近更新 更多