1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-15 23:35:34 +00:00

[assert] element.getElementsByTagName

This commit is contained in:
Witold Filipczyk 2024-04-12 19:35:38 +02:00
parent e32c69f05f
commit 59612be1f8

View File

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<body id="body">
First Name: <input name="fname" type="text" value="Michael"><br>
First Name: <input name="fname" type="text" value="Doug">
<p>Click the button to get the tag name of the first element in the body that has tag P.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById('body').getElementsByTagName("P").item(0).outerHTML;
console.assert(x === '<P>Click the button to get the tag name of the first element in the body that has tag P.</P>', 'first p');
}
console.error('element.getElementByTagName.html');
myFunction();
console.exit(0);
</script>
</body>
</html>