jquery - style.display = 'none' 适用于 IE8 但不适用于 IE11

标签 jquery html css internet-explorer-11

我的系统在IE8上运行,现在这个客户想在windows7 + IE11上使用这个系统。此代码“style.display = 'none'”不起作用。

<script language="JavaScript">
     function hide(){ 
        var type2=document.getElementsByName("type2"); 
        for(var i=0;i<type2.length;i++){
              type2[i].style.display="none"; 
         }
     } 
</script>
<table border="0" > 
     <tr> 
        <td nowrap align="left" id="type2">
             <bean:message bundle="ests" key="part"/>
        </td> 
       <td nowrap align="left" id="type2"><bean:message bundle="ests" key="ests.estRequest.label.businessKanriNo"/>
      </td> 
 	<td nowrap align="left" id="type2"><html:text maxlength="7" property="businessKanriNo" size="15" />&nbsp;
     </td> 
  </tr> 
</table>

最佳答案

 $('.btn').css('display','block','important');

或者你可以在 css 中使用它 display:none !important

或者您可以在 jquery 中使用 hide() 来隐藏元素。像这样

 $(document).ready(function(){
  $('p').hide(); //if you wanna hide <p>
 }):

关于jquery - style.display = 'none' 适用于 IE8 但不适用于 IE11,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33274424/

相关文章:

html - 元素不会对齐或无法正确响应。图片不会缩小

html - 我的导航不在我想要的位置

javascript - 使用 jquery 将外部 css 样式表应用于动态添加的 html 内容

javascript - 在客户端调试 Javascript

html - CSS - 使无衬线字体模仿等宽字体

javascript - Angular js html不更新

javascript - js对不同的div相同的onclick

jQuery $.get 在 Internet Explorer 中什么也不做?

javascript - 带有下拉列表和嵌入文本区域的 JQuery 模态对话框

javascript - jquery 没有以 HTML 形式定义