Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how will you get all the matching tags in a html file javascript

// Storing all '<li>' tags in a variable (You can do it for id and class)
// eg: document.querySelectorAll('.user-wrapper');

const html_tags = document.querySelectorAll('li');

//For each tag of html_tags variable, do:
html_tags.forEach((tag) => { 
  console.log(tag.innerText); //Will print text inside tag
})
 
PREVIOUS NEXT
Tagged: #matching #tags #html #file #javascript
ADD COMMENT
Topic
Name
2+9 =