我在HTML中有此代码
<input type="text" id="autoComplete">
我想像其他自动完成建议标签一样,在#autoComplete下添加div#autoCompleteContainer标签
我用它来将div#autoCompleteContainer标记附加到文档中
$('body').append('<div id="autoCompleteContainer">' + ' ' + '</div>');
但是我不像这样在#autoComplete下设置div#autoCompleteContainer sample
答案 0 :(得分:1)
var autoComplete = $('#autoComplete');
$('<div id="autoCompleteContainer">Successfully inserted!</div>').insertAfter(autoComplete);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" id="autoComplete">
<p>Just so you see it's between this and the input.</p>