如何从他的类名中设置div元素的visible = false? [英] How to set visible=false of div element from his class name ?
本文介绍了如何从他的类名中设置div元素的visible = false?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hii,
我想将div元素的可见性设置为false,但我不想在其上设置id,我给了Div元素的类名。所以我想根据div elemnt的类名设置
解决方案
如何使用其类名获取DIV ID [ ^ ]
< blockquote>你可以使用jQuery。我有三个步骤
1.创建两个div有一个css类而另一个没有
< div class = myClass >
隐藏div
< / div >
< div >
它是可见的div
< ; / div >
2.添加jQuery库的参考
< script type = text / javascript src = < span class =code-string> // ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js\"></script>
3.创建隐藏div的函数。我将在第一次页面/文档加载时隐藏div。
< script type = text / javascript>
(文件)。ready( function (){
Hii,
I want to set visibility of my div elements to false , but i dont wan to set id on it , I have given class name to Div element. So i want to set according to class name of that div elemnt
解决方案 How to get DIV ID using its class name[^]
You can do using jQuery. I have three steps
1. create two div one has css class and another does not have
<div class="myClass">
It is hidden div
</div>
<div>
It is visble div
</div>
2. Add reference of jQuery library
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
3. Create your function where you hide a div. I am going to hide div on first time page/document loads.
<script type ="text/javascript">
(document).ready(function () {
这篇关于如何从他的类名中设置div元素的visible = false?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文