Notes
Notes - notes.io |
//JS ecmascript ES1-ES5
//var --> let, const
var a=5;
var a=6;
let b=10;
const pi = 3.14;
//addEventListener --> browser deer hiigdeh uildeliig todorhoildog onclick
// click,scroll,input.........
const btn = document.getElementsByTagName('button')[0];
console.log(btn);
const ol = document.getElementsByTagName('ol')[0];
const input = document.getElementsByTagName('input')[0];
btn.addEventListener("click", function add(){
if(input.value==""){
alert("Cannot be empty");
}else{
// createElement('p') --> shine tag uusgeh func
let li = document.createElement('li');
console.log('li');
// appendChild() --> uusgesen tag-aa uur tag dotor oruulah func
li.innerText = input.value;
ol.appendChild(li);
input.value="";
const delBtn = document.createElement('button');
delBtn.innerHTML = '<i class="bi bi-trash"></i>';
// className --> tag-d class ner uguh func
delBtn.className = 'delete';
li.appendChild(delBtn);
//<i class="bi bi-check-square"></i>
const checkBtn = document.createElement('button');
checkBtn.innerHTML = '<i class="bi bi-check-square"></i>';
checkBtn.className = 'check';
li.appendChild(checkBtn);
}
});
ol.addEventListener('click',function toDo(e){
console.log(e.target);
let olEl = e.target;
let liEl = olEl.parentElement;
console.log(liEl);
// parentElement --> tag-iin dotorh tag ruu handah
let dltEl = liEl.parentElement;
console.log(dltEl);
// className -> class-iin neriig shalgah
if(olEl.className == 'bi bi-trash'){
dltEl.remove();
}else if(olEl.className == 'bi bi-check-square'){
//alert("done");
// classList , className --> tag deer shineer class uusgej ugdug
// classList --> toggle
let check = liEl.parentElement;
check.classList.toggle('checked');
}
});
|
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team