Q:

Click a header to add another using jquery

0

Click a header to add another using jquery

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

HTML Code :

<!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
<h1>Click me to add another!</h1>
</body>
</html>

JavaScript Code :

$("body").delegate( "h1", "click", function() {
  $(this).after( "<h1>Another header!</h1>" );
});

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now