I'm new to web dev and working on Udacity's Front-End WebDev Nanodegree and I can't get this simple js to work. It should add 4 more <div>
's but it's not linked correctly or something. I've tried, and exhausted, google and other SO questions, but it's still not working for me.
Here is my HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js">
</script>
<script src="test.js"></script>
<meta charset="UTF-8">
</head>
<body>
<div>
<div>
<div id='family1'>
<h1>Family1</h1>
<div id='alex'>
<h2>Alex</h2>
<div id='jane'>
<h3>Jane</h3>
</div>
</div>
<div id='taylor'>
<h2>Taylor</h2>
<div id='bob'>
<h3>Bob</h3>
</div>
</div>
</div>
</div>
</div>
</body>
Here is my JS:
var family1, family2, bruce, madison, hunter;
family1 = $('#family1');
family2 = $('<div id="family2"><h1>Family 2</h1></div>');
bruce = $('<div id="bruce"><h2>Bruce</h2></div>');
madison = $('<div id="madison"><h3>Madison</h3></div>');
hunter = $('<div id="hunter"><h3>Hunter</h3></div>');
family2.insertAfter(family1);
family2.append(bruce);
bruce.append(madison);
bruce.append(hunter);