简体   繁体   中英

How to Retrieve Values from a Class Within a Class Using JavaScript

I am not experienced with HTML and 'JavaScript', and is having a roadblock when attempting to check the values from a class .

Below is the source as seen from F12

在此处输入图片说明

I would like to retrieve all createdby text -muted values (as they may contain more than one row) to check if any of them matches SYSTEM , may I know how can it be done?

I understand that an image is not the best way to portrait my question, I will try to type the source in my question.

My apologies, and thank you.

You can get NodeList which contains createdby text-muted classes using document.querySelectorAll as follows.

const elems = document.querySelectorAll(".createdby .text-muted");
elems.forEach((item) => {
  console.log(item.innerHTML);  // This will contain the text value of the selected selector
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM