即使我在 中加载了 jquery,我的代码也没有响应。但我的 JSfiddle 工作正常。请帮助我我在哪里失踪。Firefox 控制台上没有发现错误。我无法弄清楚我在哪里失踪。我对 js 和 jquery JS 小提琴设置非常陌生,位于http://jsfiddle.net/3Wdr3/1/
<html>
<head>
<link rel="stylesheet" type="text/css" href="jquery.autocomplete.css" />
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
</head>
<body>
<script type="text/javascript">
var counter = 2;
var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"];
$("#addButton").click(function () {
var newTextBoxDiv = $(document.createElement('div'))
.attr("id", 'TextBoxDiv' + counter);
var roleInput = $('<input/>',{
type:'text',
placeholder:'Role',
name:'Role'+counter,
id:'textbox' + counter
});
var searchInput = $('<input/>',{
type:'text',
placeholder:'search',
name:'search'+counter,
id:'se' + counter
});
var hidd=$('<input/>',{
type:'hidden',
name:'searchhid'+counter,
id:'searchhid' + counter
});
newTextBoxDiv.append(roleInput).append(searchInput).append(hidd);
newTextBoxDiv.appendTo("#TextBoxesGroup");
$('#se' + counter).autocomplete({
source: availableTags
});
counter++;
});
</script>
<div id='TextBoxesGroup'>
<div id="TextBoxDiv1" class="form-inline control-group">
<input type='button' value='Add' id='addButton' />
</div>
</div>
</body>
</html>