Skip to content

Commit

Permalink
Merge pull request #2024 from Codebraker7/to-do
Browse files Browse the repository at this point in the history
Added enter key functionality
  • Loading branch information
fineanmol authored Oct 3, 2022
2 parents 1bb19ce + 58cd803 commit 0f7d315
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions frontend projects/To-do-list/To-do-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ const allTaskList = document.querySelector('.all-task')
const completed_task = document.querySelector('.completed-task');
const completed_task_heading = document.querySelector('.completed-task-heading')

btn.onclick= function() {
btn.addEventListener("click", myFunction);
window.addEventListener("keypress",function(event){
if(event.key === "Enter"){
myFunction();
}
});

function myFunction() {
const typedValue =task.value;
if(typedValue!==''){

Expand Down Expand Up @@ -91,5 +98,4 @@ btn.onclick= function() {

}

};

};

0 comments on commit 0f7d315

Please sign in to comment.