JS - function of get specific ID element in P element with getElementsByTagName

0 votes
155 views
added Dec 17, 2020 in Javascript by lcjr First Warrant Officer (11,830 points)
function myChoc() {
  var x = document.getElementsByTagName("P").namedItem("chocolate");
  alert(x.innerHTML);
}

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...