问题描述
有什么想法可能导致此错误?
Any ideas what might be causing this error?
我的清单包括
<link rel="stylesheet" href="../../node_modules/semantic-ui/dist/semantic.min.css">
<link rel="stylesheet" href="../../node_modules/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="../../node_modules/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="../../node_modules/fullcalendar/dist/fullcalendar.min.css">
<script src="../../node_modules/semantic-ui/dist/semantic.min.js"></script>
<script src="../../node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="../../node_modules/moment/min/moment.min.js"></script>
<script src="../../node_modules/fullcalendar/dist/fullcalendar.min.js"></script>
HTML元素:
<div class="ui floating dropdown labeled search icon button" style="width: 95%; margin: 0 auto;" id="monthDrop">
<i class="calendar icon"></i>
<span class="text">Choose a Month</span>
<div class="menu">
<div class="item">January</div>
<div class="item">February</div>
<div class="item">March</div>
<div class="item">April</div>
<div class="item">May</div>
<div class="item">June</div>
<div class="item">July</div>
<div class="item">August</div>
<div class="item">September</div>
<div class="item">October</div>
<div class="item">November</div>
<div class="item">December</div>
</div>
</div>
脚本:
$('#monthDrop').dropdown();
它可以很好地呈现所有内容,并且在加载时没有错误,只有当我尝试单击它时才这样:
It renders fine and everything and no errors on load, just this when I try to click on it:
推荐答案
我们在使用以下html时遇到了相同的错误:
We ran into the same error with the following html:
<select class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" role="button" v-model="selected" aria-haspopup="true" aria-expanded="false">
<option disabled value="">Please select one</option>
<option class="dropdown-item" value="type1">Carrier</option>
<option class="dropdown-item" value="type2">Shipper</option>
</select>
我们尝试从< select>
标记中删除 data-toggle ="dropdown"
;该错误不再发生,并且下拉菜单仍然起作用.不确定为什么为什么有效,但是它为我们摆脱了错误.一定是冲突吗?无论如何,如果其他人正在寻找解决方案,则此变通办法可能对他们有用.
We tried removing data-toggle="dropdown"
from the <select>
tag; the error no longer occurred, and the dropdown menu still functioned. Not sure why this works, but it got rid of the error for us. Must be a conflict somehow? Anyways, if someone else is looking for a solution, this workaround may work for them.
这篇关于未捕获的TypeError:无法读取Object.onLoad上未定义的属性"setAttribute"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!