我想当我选择组1从jQuery用户界面自动完成搜索选择大的数据大小属性或包1.1,只需用数据包=“1” DIV节目属性,当我选择组2或包1.2,刚好与DATA-属性包=“2” DIV节目,如果我选择组1和组3,只是用数据包属性=“3” DIV显示,等等。
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/superhero/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://www.jqueryscript.net/demo/Live-Search-Plugin-jQuery-e-search/e-search.js"></script>
<link href="http://www.jqueryscript.net/css/jquerysctipttop.css" rel="stylesheet" type="text/css">
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<input class="search" />
<div class="package" data-package="1" data-size="10" style="">packg 1</div>
<div class="package" data-package="2" data-size="20" style="">packg 2</div>
<div class="package" data-package="3" data-size="30" style="">packg 3</div>
<div class="package" data-package="4" data-size="40" style="">packg 4</div>
<div class="package" data-package="5" data-size="50" style="">packg 5</div>
<div class="package" data-package="6" data-size="60" style="">packg 6</div>
<script type="text/javascript">
jQuery(function() {
var availableTags = [
{value: "pack 1",id: 1},
{value: "pack 1.1",id: 2},
{value: "pack 2",id: 3},
{value: "pack 2.2",id: 4},
{value: "pack 3",id: 5},
{value: "pack 3.3",id: 6},
{value: "pack 4",id: 7},
{value: "pack 4.4",id: 8},
{value: "pack 5",id: 9},
{value: "pack 5.5",id: 10},
{value: "pack 6",id: 11},
{value: "pack 6.5",id: 12}
];
jQuery(".search").autocomplete({
source: availableTags
});
});
</script>