我使用jQuery自动完成插件,直到今天它工作得很好。但是我对当前代码进行了一些更改(有很多改进,我无法跟踪哪些代码更新破坏了我的自动完成),现在它显示了非常不寻常的显示问题。
当我在输入文本中输入公司名称时,自动填充结果显示在网站的左上角:
也许有人有类似的问题?
更新
jQuery的:
<script>
$(function() {
var availableTags2 = <?php echo '["' . implode('", "', $real_companies) . '"]' ?>;
$( "#companies_for_tabs" ).autocomplete({
source: availableTags2,
select: function (a, b) {
$(this).val(b.item.value);
$("#extra-reason").show(400);
$("#recommend-company-href").attr("onclick","document.forms['recommend-company-from-events'].submit();");
}
});
});
</script>
HTML:
<form action="recommend_from_events.php" method="post" class="advanced-form" id="recommend-company-from-events">
<input type="text" name="company" placeholder="Who you want to recommend?" autocomplete="off" id="companies_for_tabs">
<textarea name="extra" style="display: none;" placeholder="Why you recommend? (optional)" maxlength="300" id="extra-reason"></textarea></td></tr>
<a class="save-button" id="recommend-company-href"><span>Recommend company</span></a>
</form>