Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -221,5 +221,6 @@ <h5 class="modal-title">
<!-- Bootstrap -->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.bundle.min.js"></script>
<!-- JS Code -->
<script src="./index.js"></script>
</body>
</html>
23 changes: 23 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
document.addEventListener('DOMContentLoaded', function(){
const title = document.getElementById('title');
const description = document.getElementById('description');
const btn = document.getElementById('add');
const alert = document.getElementById('alert');


function addTodo(){
if (title.value === '' || description.value === ''){
//console.error('Title and description are required');
alert.classList.remove('d-none');
alert.innerText = 'Title and description are required';
return;
}
/*
else{
console.log('ok');
}*/
alert.classList.add('d-none');
}
btn.onclick = addTodo;

})