Virtualization creating list
Firstly we need to crate index.html where we should link css and javascript files
|
|
Then we need a text input to receive the texts, a button to bind function to pass the text to dom by creating html elements an unordered list where we can insert list element in.
|
|
Now we can get button element to give it functionality within main.js
|
|
when we click on button an anonymous function will be assigned to onclick method, so this is writing implementation for onclick method
|
|
we are going to get input element and assign the value is entered to variable then check if it is null.
|
|
we are going to create an html element, a child node and append it to html element. html element is all the html tags while html nodes all the child nodes with in tag.
|
|
we will get list which is ul tag and will append list node to it
|
|
Lastly we will add a class name to style via css, every 3.rd child of list element a class will be added. the important point here; to reach child elements we can use children while to reach child nodes we use childNode methods.
|
|
style.css
|
|