skip to Main Content

How to dynamically retrieve the content text of a HTML tag and its child tags?

I would like to know how to dynamically retrieve the content text of a HTML tag and its child tags? Here is my HTML code, for example: <p><code>C:<select> <option value="test1">test1</option> <option value="test2">test2</option> </select>test3<select> <option value="test4">test4</option> <option value="test5">test5</option> </select>test6<select> <option value="test7">test7</option>…

VIEW QUESTION

Animation with InnerHTML

document.getElementById("first-img").addEventListener("click", function(){ document.getElementById("detail-img").innerHTML = `Detail of first img` }) document.getElementById("second-img").addEventListener("click", function(){ document.getElementById("detail-img").innerHTML = `Detail of second img` }) .container{ display: flex; height: 30px; gap: 1rem; } .img{ background-color: red; } <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width,…

VIEW QUESTION
Back To Top
Search