Home >Web Front-end >JS Tutorial >JS control display and hide compatibility issues (IE6, IE7, IE8)_javascript skills

JS control display and hide compatibility issues (IE6, IE7, IE8)_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:30:591264browse

In IE7,

Use jQuery

Display: $("#a").attr("style","");

Hide: $("# a").attr("style","display:none");

But this method of displaying does not work in IE8

IE8

Display: $("# a").removeAttr("style");

Hide: $("#a").attr("style","display:none");

IE6, the weirdest , using display:none cannot hide the select tag

The following two, after testing, can be used normally in three versions

Hide: document.getElementById("a").style .display="none";

Display: document.getElementById("a").style.display="";

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn