Difference between revisions of "Main Page"

From Networks of Care
Jump to navigation Jump to search
Line 1: Line 1:
 +
<!DOCTYPE html>
 
<html>
 
<html>
<div id="mw-mywiki-example"></div>
+
<head>
 +
<style>
 +
.anchors {
 +
  display: block;
 +
  padding: 5px;
 +
  background-color: black;
 +
  color: white;
 +
}
 +
 
 +
#myAnchor {
 +
  background-color: dodgerblue;
 +
}
 +
</style>
 +
</head>
 +
<body>
 +
 
 +
<a class="anchors" id="myAnchor" href="https://www.w3schools.com/html/">HTML</a>
 +
<a class="anchors" href="https://www.w3schools.com/css/">CSS</a>
 +
<a class="anchors" href="https://www.w3schools.com/js/">JavaScript</a>
 +
 
 +
<p>Click the button to display the value of the id attribute of the first link above.</p>
 +
 
 +
<button onclick="myFunction()">Try it</button>
 +
 
 +
<p id="demo"></p>
  
 
<script>
 
<script>
$(function () {
+
function myFunction() {
var myElement = document.getElementById('mw-mywiki-example');
+
  var x = document.getElementsByClassName("anchors")[0].id;
myElement.innerHTML = 'any HTML';
+
  document.getElementById("demo").innerHTML = x;
}());
+
}
 
</script>
 
</script>
  
 
+
</body>
 
</html>
 
</html>

Revision as of 14:50, 6 April 2020

<!DOCTYPE html> HTML CSS JavaScript

Click the button to display the value of the id attribute of the first link above.