Skip to content

Commit 75a080d

Browse files
committed
add listeners
1 parent b0e834c commit 75a080d

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ <h5 class="modal-title"></h5><button type="button"
3535
<h1 class="display-3 mb-0">RSS агрегатор</h1>
3636
<p class="lead">Начните читать RSS сегодня! Это легко, это красиво.
3737
</p>
38-
<form action="" class="rss-form text-body">
38+
<form action="" id="rss-form" class="rss-form text-body">
3939
<div class="row">
4040
<div class="col">
4141
<div class="form-floating"><input id="url-input" autofocus=""
@@ -44,7 +44,7 @@ <h1 class="display-3 mb-0">RSS агрегатор</h1>
4444
autocomplete="off"> <label for="url-input">Ссылка
4545
RSS</label></div>
4646
</div>
47-
<div class="col-auto"><button type="submit" aria-label="add"
47+
<div class="col-auto"><button id="add-feed-btn" type="submit" aria-label="add"
4848
class="h-100 btn btn-lg btn-primary px-sm-5">Добавить</button>
4949
</div>
5050
</div>

src/js/main.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { updateInputValue, addRssFeed } from "./model";
2+
3+
const input = document.querySelector("#url-input");
4+
const form = document.querySelector("#rss-form");
5+
6+
input.addEventListener('input', (e) => {
7+
updateInputValue(e.target.value);
8+
});
9+
10+
form.addEventListener('submit', (e) => {
11+
e.preventDefault();
12+
addRssFeed();
13+
});
14+
15+
16+
17+
18+
19+

0 commit comments

Comments
 (0)