eTarget.id.style.display = 'none' not working
eTarget.id.style.display = 'none' not working
我想在点击时使用HTML代码后面的脚本隐藏这个div,但它似乎不工作,虽然在代码之间添加alert(ettarget .id)返回div id specc。如果我简单地替换事件。在脚本中使用specsC,它工作得很好。
<div class = 'tile1c' id='specsC' onclick='hide()'>
<h3>Specifications</h3>
</div>
<script type='text/javascript'>
function hide(e){
if(!e)
e = window.event;
eTarget = e.target || e.srcElement;
eTarget.id.style.display = 'none';
}
<script>
Try just:
eTarget.style.display = 'none';
id
不应该在那里。
eTarget.id
解析为字符串"specsC"
相关文章:
- jQuery is not loaded
- AngularJS JSON not arriving php
- $rootScope not working
- reactRedux is not defined
- jQuery document.ready not working
- Javascript/Jquery Blob not showing Chrome PDF
- ReferenceError: not defined
- ReferenceError: cordova is not defined @ng-cordova.min.js:7
- Javascript getElementsByTagName not working?
- jQuery's trim()的前缀为not运算符
- Javascript - element.childNodes does not see an append.newch
- 如果连接类型为none,则Javascript Function Only警报
- SemanticUI模态not onDeny/onApprove事件未激发
- 列表样式在IE中未设置为none,但在IE中适用
- 重写CSS:使用jquery显示none属性
- WebkitTransform not fluent
- JQuery.val( ) not working
- jQuery - display : none not working
- display:none does not work
- eTarget.id.style.display = 'none' not working