Skip to content

Commit 2a92c82

Browse files
committed
replace index file
1 parent ff5dc46 commit 2a92c82

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

Allfiles/Mod03/Democode/Lesson02/HtmlDOMSample/HtmlDOMSample/HtmlDOMSample.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,13 @@
9494
<Content Include="Content\Site.css" />
9595
<Content Include="fonts\glyphicons-halflings-regular.svg" />
9696
<Content Include="Global.asax" />
97+
<Content Include="index.html" />
9798
<Content Include="Scripts\IndexScript.js" />
9899
<Content Include="Scripts\modernizr-2.6.2.js" />
99100
<Content Include="Web.config" />
100101
</ItemGroup>
101102
<ItemGroup>
102103
<Compile Include="App_Start\RouteConfig.cs" />
103-
<Compile Include="Controllers\HomeController.cs" />
104104
<Compile Include="Global.asax.cs">
105105
<DependentUpon>Global.asax</DependentUpon>
106106
</Compile>
@@ -114,7 +114,6 @@
114114
<None Include="packages.config" />
115115
<Content Include="Views\_ViewStart.cshtml" />
116116
<Content Include="Views\Shared\_Layout.cshtml" />
117-
<Content Include="Views\Home\Index.cshtml" />
118117
<None Include="Web.Debug.config">
119118
<DependentUpon>Web.config</DependentUpon>
120119
</None>
@@ -124,6 +123,7 @@
124123
</ItemGroup>
125124
<ItemGroup>
126125
<Folder Include="App_Data\" />
126+
<Folder Include="Controllers\" />
127127
<Folder Include="Models\" />
128128
<Folder Include="Views\Index\" />
129129
</ItemGroup>

Allfiles/Mod03/Democode/Lesson02/HtmlDOMSample/HtmlDOMSample/Scripts/IndexScript.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
function addHobbies() {
1+
function init() {
2+
document.getElementById('newHobbyBtn').addEventListener('click', addHobbies);
3+
}
4+
5+
init();
6+
7+
function addHobbies() {
28
//Get all hobbies inputs
39
const inputList = document.querySelectorAll('.hobbiesInput');
410
//check if hobbies input elements less then 5
@@ -7,15 +13,15 @@
713
const hobbiesList = document.getElementById('hobbiesList');
814
//Create new elements
915
const newLineElement = createNode('br'),
10-
createNode('input');
16+
inputElement = createNode('input');
1117
//Set class attribute to the new input element
1218
inputElement.setAttribute("class", "hobbiesInput");
1319
//Insert the new elements to the end of the div
1420
append(hobbiesList, newLineElement);
1521
append(hobbiesList, inputElement);
1622
}
1723
else {
18-
alert("Can't add more hobbies (max: 5)");
24+
document.getElementById('newHobbyBtn').removeEventListener('click', addHobbies);
1925
}
2026
}
2127

0 commit comments

Comments
 (0)