2021-05-12 11:08:05 -04:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
First Name: <input name="fname" type="text" value="Michael"><br>
|
|
|
|
First Name: <input name="fname" type="text" value="Doug">
|
|
|
|
|
2022-08-30 10:07:14 -04:00
|
|
|
<p>Click the button to get the outer html of anchor number 1. Anchors are counted from 0.</p>
|
2021-05-12 11:08:05 -04:00
|
|
|
|
|
|
|
<button onclick="myFunction()">Try it</button>
|
|
|
|
|
|
|
|
<a href="/">/</a>
|
|
|
|
<a href="/home">/home</a>
|
|
|
|
|
|
|
|
<p id="demo"></p>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
function myFunction() {
|
|
|
|
var x = document.anchors.item(1).outerHTML;
|
2021-11-10 12:05:35 -05:00
|
|
|
window.alert(x);
|
2021-05-12 11:08:05 -04:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|