【发布时间】:2016-09-17 07:29:38
【问题描述】:
我想在焦点上显示自动完成选项。如果输入的值为空,我想显示所有选项。我想要的行为相当于以下效果:
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8/>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.2.3/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
</head>
<body>
<input id="text" type="text"></input>
<script>
$(
function() {
$('#text').autocomplete(
{ source: ['abc', 'bcd', 'cde'], minLength: 0 }
).focus(function() { $(this).autocomplete('search'); });
}
);
</script>
</body>
</html>
如何使用 Django-selectable 做到这一点?
【问题讨论】:
标签: jquery python django jquery-ui