为什么多个自动完成没有运行? 这是我的代码:
<script>
<![CDATA[
$(function () {
var availableTags = [
"ADMINISTRATOR",
"BRANCHMANAGER",
"BACKOFFICE",
"CUSTOMERSERVICE",
"HEADTELLER",
"TELLER"
];
function split( val ) {
return val.split( /,\s*/ );
}
function extractLast( term ) {
return split( term ).pop();
}
$( "#userLevelRool" )
// don't navigate away from the field on tab when selecting an item
.bind( "keydown", function( event ) {
if ( event.keyCode === $.ui.keyCode.TAB &&
$( this ).data( "autocomplete" ).menu.active ) {
event.preventDefault();
}
})
.autocomplete({
minLength: 0,
source: function( request, response ) {
// delegate back to autocomplete, but extract the last term
response( $.ui.autocomplete.filter(
availableTags, extractLast( request.term ) ) );
},
focus: function() {
// prevent value inserted on focus
return false;
},
select: function( event, ui ) {
var terms = split( this.value );
// remove the current input
terms.pop();
// add the selected item
terms.push( ui.item.value );
// add placeholder to get the comma-and-space at the end
terms.push( "" );
this.value = terms.join( ", " );
return false;
}
});
});
]]>
</script>
这是我的意见:
<h:label>User Level</h:label>
<h:input name="userLevel" id="userLevelRool"/>
这是我的代码HTML:
<script type="text/javascript" src="jsonFunctions.js" charset="UTF-8"></script>
<?script type="text/javascript" src="development-bundle/jquery-1.4.4.js" ?>
<?script type="text/javascript" src="practiceJS.js"?>
<?script type="text/javascript" src="AcctionFormJquery/currency.js" ?>
<?script type="text/javascript" src="Configuration/urlmiddle.js" charset="UTF-8"?>
<?script type="text/javascript" src="AcctionFormJquery/validate.js"?>
<?script type="text/javascript" src="js/function.js"?>
<?script type="text/javascript" src="js/jquery.alerts"?>
<?script type="text/javascript" src="AcctionFormJquery/createArrayToDiv.js"?>
<?script type="text/javascript" scr="jquery.jqGrid-4.1.2/js/jquery-1.5.2.min.js"?>
<?script type="text/javascript" src="ucoreJs/jquery.formatCurrency-1.4.0.js" ?>
<?script type="text/javascript" src="ucoreJs/jquery.formatCurrency.all.js"?>
<?script type="text/javascript" src="ucoreJs/sliding.form.js" ?>
<!--libery old -->
<h:link rel="stylesheet" type="text/css" media="screen" href="jquery-ui-1.8.10.custom/development-bundle/themes/le-frog/jquery-ui-1.8.10.custom.css" />
<h:link rel="stylesheet" type="text/css" media="screen" href="jquery-ui-1.8.10.custom/development-bundle/themes/le-frog/jquery.ui.all.css" />
<h:link rel="stylesheet" type="text/css" media="screen" href="jquery-ui-1.8.10.custom/development-bundle/themes/le-frog/jquery.ui.theme.css" />
<h:link rel="stylesheet" type="text/css" media="screen" href="jquery-ui-1.8.10.custom/development-bundle/themes/le-frog/jquery.ui.datepicker.css" />
<h:link rel="stylesheet" type="text/css" media="screen" href="jquery.jqGrid-4.1.2/css/ui.jqgrid.css" /><!--New @ Agust 08 2011-->
<?script type="text/javascript" src="jquery-ui-1.8.10.custom/development-bundle/external/jquery.bgiframe-2.1.2.js" ?> <!-- libary for messageBox -->
<?script type="text/javascript" src="js/ajaxfileupload.js" ?>
<?script type="text/javascript" src="jquery-ui-1.8.10.custom/development-bundle/ui/jquery-ui-1.8.10.custom.js" ?>
<?script type="text/javascript" src="js/jquery.layout.js" ?>
<?script type="text/javascript" src="jquery.jqGrid-4.1.2/js/i18n/grid.locale-en.js" ?><!--New @ Agust 08 2011-->
<?script type="text/javascript" src="js/grid.inlinedit.js" ?>
<?script type="text/javascript" src="jquery.jqGrid-4.1.2/js/jquery.jqGrid.min.js" ?><!--New @ Agust 08 2011-->
<?script type="text/javascript" src="js/jquery.json-2.2.js" ?>
<?script type="text/javascript" src="jquery.validate.js" ?>
<?script type="text/javascript" src="ucoreJs/validate.js" ?>
<!--New @ Agust 08 2011-->
<?script type="text/javascript" src="jquery.jqGrid-4.1.2/plugins/jquery.tablednd.js" ?>
<?script type="text/javascript" src="jquery.jqGrid-4.1.2/plugins/jquery.contextmenu.js" ?>
<?script type="text/javascript" src="jquery.jqGrid-4.1.2/plugins/ui.multiselect.js" ?>
<?script type="text/javascript" src="jquery-ui-1.8.10.custom/development-bundle/ui/jquery.ui.core.js"?>
<?script type="text/javascript" src="jquery-ui-1.8.10.custom/development-bundle/ui/jquery.ui.autocomplete.js" ?>
<?script type="text/javascript" src="jquery-ui-1.8.10.custom/development-bundle/ui/jquery.ui.draggable.js"?>
<?script type="text/javascript" src="jquery-ui-1.8.10.custom/development-bundle/ui/jquery.ui.resizable.js"?>
<?script type="text/javascript" src="jquery-ui-1.8.10.custom/development-bundle/ui/jquery.ui.dialog.js"?>
<?script type="text/javascript" src="jquery-ui-1.8.10.custom/development-bundle/ui/jquery.ui.progressbar.js"?>
<?script type="text/javascript" src="jquery-ui-1.8.10.custom/development-bundle/external/jquery.bgiframe-2.1.2.js"?>
<?script src="jquery-ui-1.8.10.custom/development-bundle/ui/jquery.ui.widget.js" ?>
<?script src="jquery-ui-1.8.10.custom/development-bundle/ui/jquery.ui.datepicker.js"?>
<!-- Css Style -->
<h:link rel="stylesheet" type="text/css" href="ucoreCss/styleFormUcore.css" />
<?script type="text/javascript" src="jquery-ui-1.8.10.custom/development-bundle/ui/jquery.ui.widget.js" ?>
<?script type="text/javascript" src="jquery-ui-1.8.10.custom/development-bundle/ui/jquery.ui.autocomplete.js" ?>
<?script type="text/javascript" src="jquery-ui-1.8.10.custom/development-bundle/ui/jquery.ui.mouse.js" ?>
<?script type="text/javascript" src="jquery-ui-1.8.10.custom/development-bundle/ui/jquery.ui.button.js" ?>
<?script type="text/javascript" src="jquery-ui-1.8.10.custom/development-bundle/ui/jquery.ui.draggable.js"?>
<?script type="text/javascript" src="jquery-ui-1.8.10.custom/development-bundle/ui/jquery.ui.position.js" ?>
<?script type="text/javascript" src="jquery-ui-1.8.10.custom/development-bundle/ui/jquery.effects.core.js" ?>
我的html代码可能有问题吗?