If you prefer to try this in your browser (without jfiddle):
Cut and paste the following code into your editor and save as a file named (e.g.) "golf_strokes.html"...
then run it by typing the following into your browser's address bar:
file:///C:/Dev/golf_strokes.html
and hit return
If you do this in chrome you can use its nice debugging features to see what is happening as you make further changes... (hit F12 to open the debug console)
Code:
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>
$(document).ready(function () {
initialize();
});
function initialize() {
var mainDiv = $("#golfShotForm");
var titleDiv = $("<div/>").html("Shots for Hole 1:");
var addShotButton = $("<button/>").html("Add Another Shot").click(function () {
addNewShotInputDiv(mainDiv);
});
mainDiv.append(addShotButton);
mainDiv.append(titleDiv);
addNewShotInputDiv(mainDiv);
};
function addNewShotInputDiv(mainDiv) {
var shotInputDiv = $("<div/>");
var optionTypeTee = $("<option/>").html("Tee");
var optionTypeFairway = $("<option/>").html("Fairway");
var optionTypeRough = $("<option/>").html("Rough");
var optionTypeSand = $("<option/>").html("Sand");
var optionTypeGreen = $("<option/>").html("Green");
var selectType = $("<select/>");
selectType.append(optionTypeTee);
selectType.append(optionTypeFairway);
selectType.append(optionTypeRough);
selectType.append(optionTypeSand);
selectType.append(optionTypeGreen);
var selectTypeLabel = $("<span/>")
.attr("id", "selectTypeLabel")
.html("Ball location: ");
var inputDistanceFromHole = $("<input/>").attr("id", "inputDistance");
var inputDistanceLabel = $("<span/>")
.attr("id", "inputDistanceLabel")
.html("Distance from pin: ");
shotInputDiv.append(selectTypeLabel)
.append(selectType)
.append(inputDistanceLabel)
.append(inputDistanceFromHole);
mainDiv.append(shotInputDiv);
};
</script>
<style>
#titleDiv {
color: black;
}
#inputDistance {
width: 3.0em;
}
#inputDistanceLabel {
margin-left: 1.0em;
}
</style>
</head>
<body>
<div id="golfShotForm"/>
</body>
</html>