开发者

newbie in Jquery (including but no result)

I have this code:

   <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>

I downloaded the jquery but it has no result I used this site:

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

what is wrong here?


You must embed jQuery before jQuery UI, because UI uses 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" />  

instead of

<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>


Did you try placing your code inside of a ready function?

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


Try putting the

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

Inside the <head></head> element. Also the <script src=".."> should be in <head> as well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜