2012年7月30日 星期一

jQuery UI Use Info

If you had got jQuery UI. and go to see some example.

I will use the AutoComplete to show you show you something.

you could see the code as bloew.


<head>
<meta charset="utf-8">
<title>jQuery UI Autocomplete - Default functionality</title>
<link rel="stylesheet" href="themes/redmond/jquery.ui.all.css">
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="jquery-ui-1.8.21.custom.min.js"></script>
<!--
<script src="ui/jquery.ui.core.js"></script>
<script src="ui/jquery.ui.widget.js"></script>
<script src="ui/jquery.ui.position.js"></script>
<script src="ui/jquery.ui.autocomplete.js"></script>
 -->

<script>
$(document).ready($(function() {
var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
$( "#tags" ).autocomplete({
source: availableTags
});
}));

$(document).ready(
$(function() {
$('#tag1').html('Hello jQuery');
}
));
</script>
</head>

Pay attention on the <script type="text/javascript" src="jquery-ui-1.8.21.custom.min.js"></script>

And


<script src="ui/jquery.ui.core.js"></script>
<script src="ui/jquery.ui.widget.js"></script>
<script src="ui/jquery.ui.position.js"></script>
<script src="ui/jquery.ui.autocomplete.js"></script>


that is why the funtion "autocomplete" work as this code:


$( "#tags" ).autocomplete({
source: availableTags
});

Because all the example you see on jQuery page all work by some JS.
Like jquery.ui.autocomplete.js
And they take all in one JS File: jquery-ui-1.8.21.custom.min.js

That is tell you if you want to build some project as the example you learn on jQuery page.
you could use these code by include in

<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="jquery-ui-1.8.21.custom.min.js"></script>



沒有留言:

張貼留言