使用jquery在div标记中自动建议
我有10个章节名称,分别以使用jquery在div标记中自动建议,jquery,Jquery,我有10个章节名称,分别以[[[和]]开头和结尾 我必须对设置为contenteditable=true的div标记执行自动建议 当用户写入[[时,它会显示节名 div标记中不支持自动完成 <div id="textbox" class="mousetrap" contenteditable="true" autocomplete="on" spellcheck="true"> </div> $(function() {
[[[
和]]
开头和结尾
我必须对设置为contenteditable=true的div标记执行自动建议
当用户写入[[
时,它会显示节名
div标记中不支持自动完成
<div id="textbox" class="mousetrap" contenteditable="true" autocomplete="on" spellcheck="true">
</div>
$(function() {
var availableTags = [
"Window",
"Door and frame",
"Ceilling",
"Condition"
];
$("#textbox").autocomplete({
source: availableTags
});
});
$(函数(){
var availableTags=[
“窗口”,
“门和框架”,
“天花板”,
“条件”
];
$(“#文本框”).autocomplete({
资料来源:availableTags
});
});
有什么建议吗?您必须稍微更改一下代码,然后它才能开始工作
就像下面
$(function() {
$.fn.val = $.fn.html;
var availableTags = [
"Window",
"Door and frame",
"Ceilling",
"Condition"
];
$("#textbox").autocomplete({
source: availableTags
});
});
休息吧,你做完了
我把我的全部代码放在下面
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title> - jsFiddle demo</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css">
<script type="text/javascript">
//<![CDATA[
$(window).load(function(){
$(function() {
$.fn.val = $.fn.html;
var availableTags = [
"Window",
"Door and frame",
"Ceilling",
"Condition"
];
$("#textbox").autocomplete({
source: availableTags
});
});
});
//]]>
</script>
</head>
<body>
<div id="textbox" class="mousetrap" contenteditable="true" autocomplete="on" spellcheck="true">
</div>
</body>
</html>
-JSFIDLE演示
//
请在这里添加html和js代码好吗?@NeerajKumar我只做了这么多显示错误:对象不支持jquery ui$(“#textbox”).autocomplete({})中的属性或方法'prop';已使用..div标记中支持自动完成?您在哪里使用道具?是的,html5中的div支持自动完成,这就是我给您的完整代码。