What's the best way to get all the DOM elements on a page using jQuery?
Thank,
DLiKS
Edit: this is for use in a script that prints an entire page using grayscale.js - http://james.padolsey.com/demos/grayscale/ . jQuery because I can !: P
var allOfThem = $('*');
You do not need jQuery for this:
var allOfThem = document.getElementsByTagName('*');
document.getElementsByTagName("*") will return all DOM elements as “relevant” elements with all their contents and properties and everything.
document.getElementsByTagName("*")
$('*') $("body *") jQuery, . , jQuery.
$('*')
$("body *")
, - , jQuery.
It seems you want $("body *")equivalentdocument.documentElement.getElementsByTagName('*')
document.documentElement.getElementsByTagName('*')
Oddly enough, getElementsByTagName('*')it seems to break my Firefox / Firebug, and the jQuery version works fine
getElementsByTagName('*')
Source: https://habr.com/ru/post/1771501/More articles:An HTTP module session is not installed on a page without an extension - c #Extract number from day in pl sql - dateПеренаправление с помощью cURL? - phpManaging windows using a window handle from different processes in MS Windows (XP) - winapiA column with a null value and NOT EXISTS T-sql - sqlNumber of Transactions - badaHow to set up ejb both local and remote on Websphere - websphereUsing MPMusicPlayerController plays MPMediaItemCollection, how to get event at the end of playback - eventsCheck if application updates work without going to the App Store - iphoneHow can I “catch” every seventh element in the list? - phpAll Articles