最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

html - using javascript find div tag display property is none or block or undefined - Stack Overflow

programmeradmin0浏览0评论

using that code i am able to find tag display propery but i want to get all the tag which have their display property none.Give me the result using javascript or jquery

document.getElementById('MSO_ContentTable').style.display

MSO_ContentTable is an id of div tag

using that code i am able to find tag display propery but i want to get all the tag which have their display property none.Give me the result using javascript or jquery

document.getElementById('MSO_ContentTable').style.display

MSO_ContentTable is an id of div tag

Share Improve this question asked Jul 19, 2011 at 7:50 V_BV_B 1,5695 gold badges18 silver badges39 bronze badges 3
  • You want to find all hidden tags? What are you trying to achieve, what's the end goal? – Shef Commented Jul 19, 2011 at 7:55
  • i am calculating total word in html page . i want to remove all the tag from calculation which have their display property none – V_B Commented Jul 19, 2011 at 7:58
  • Gave you an answer. With that selector you will find all the hidden elements of the page. – Shef Commented Jul 19, 2011 at 8:09
Add a ment  | 

5 Answers 5

Reset to default 3
$('div').filter(function() {
    return $(this).css('display') == 'none'; //or whatever you want to filter.
})

See it in action.

$(':hidden')

That should do just fine for you.

Using jQuery you can try the below code to find all the elements which are hidden on the page

$("*").is(":hidden").not("input:hidden");

If a jquery solution is okay you could do:

     $('*:not(:visible)')

this returns a collection of all non visible objects in the dom.

These are elements that:

  • They have a CSS display value of none.
  • They are form elements with type="hidden".
  • Their width and height are explicitly set to 0.
  • An ancestor element is hidden, so the element is not shown on the page

You could filter out only those with "display:none" by iterating on them

Try this code : $("#MSO_ContentTable").css("display","none"); Using Jquery , All document by id "MSO_ContentTable" is Gone ....

发布评论

评论列表(0)

  1. 暂无评论