How to get all elements between html tag?

I want to get all elements from the web page.i used form id or name to get all elements but if there is no form id or name i can't get elements from that page.what is the alternate for this problem. please help.


You can use jQuery: $("html *") which will return all elements between the html tags

for names you must use $("html *").attr('name') for values $("html *").val() or $("html *").attr('value')

You can retrieve an array of all nodes in a html document using document.getElementsByTagName('*'). After that you can iterate through that array:

var allElements = document.getElementsByTagName('*');
for (var i=0;i<allElements.length;i++){
  //do things with the element, e.g.

Update 2014: a more modern approach would be

var allEls = []'*');
allEls.forEach( function (el) {
      //do things with the element, e.g.

Need Your Help

Accessing MySQL relations with Ruby on Rails

mysql ruby-on-rails

How do you access a MySQL relation using RoR?

parse add multiple images to an array after loop

ios iphone arrays swift

I have an item Object which has a relation class which contain several images related to the item. The problem is I'm trying to add these images to an array so first inside the loop I'm adding them...