如何在不使用CSS的情况下隐藏DIV? [英] How can I hide a DIV without using CSS?
本文介绍了如何在不使用CSS的情况下隐藏DIV?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在页面加载时隐藏DIV但由于我的某些页面限制而无法使用CSS。
I'd like to hide a DIV on page load but cannot use CSS due to certain page restrictions that I have.
如何使用Javascript隐藏DIV或其他一些方法?我想在页面加载时隐藏DIV,而无需用户按下按钮。
How can hide a DIV using Javascript or some other method? I'd like to have the DIV hidden on page load without requiring the user to press a button.
干杯。
推荐答案
window.onload = function(){
document.getElementById('your_div_id').style.display = 'none';
}
或者,在jQuery中:
Or, in jQuery:
$(document).ready(function(){
$('#your_div_id_or_other_selector').hide();
});
这篇关于如何在不使用CSS的情况下隐藏DIV?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文