php - Dynamically Populating Javascript Array Based On CSS Class? -


I am in the process of creating an app that is currently a large number of hidden devices that need to go through cycling. is.

Right now, there are only 5 divisions in the cycle, but eventually 20+. What is the method of bringing all their IDs into the array based on their initial class in CSS? There is a class 'show tab' in the default device and the other has the class 'hide tab' I would love to arrange the array with all the IDs of elements in the 'tab' category.

I tried Elements by Class, but I do not think I understand how it works - this is just

Most pages are coded in PHP, so If ID is a way to use PHP and then it passes to JavaScript, whatever works.

P> Any help would be appreciated =)

Divs will be found in an array using classified "pure" JavaScript (i.e. out-the-box javascript):

  var tab = document.getElementsByClassName ('tab');   

There may be other categories that apply to the divisions, but if they have a "tab" category, they will be included. The tab array will then have an array of DOM objects to reach the Divs' ID, you will do this:

  var id = tab [0] .id;   

In addition, if you ever want to use jQuery, it will create a similar array-like object such as divs:

  var tab = $ ('Tab');    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -