+ 1

We can add an element with appEnd() in JQuery But What about JavaScript ?

How can I add a element to end of div in JavaScript ?

31st May 2017, 4:35 PM
Serhat Merak
Serhat Merak - avatar
6 odpowiedzi
+ 10
element.appendChild( );
31st May 2017, 4:37 PM
Maz
Maz - avatar
+ 10
It appends an element to an another element. :) Add a class? element.className = "your_class";
31st May 2017, 4:41 PM
Maz
Maz - avatar
+ 9
txt.className = "..." txt.name = "..." Cross Browser solution - https://stackoverflow.com/questions/1362513/can-i-use-javascript-to-set-the-name-attribute
31st May 2017, 4:52 PM
Maz
Maz - avatar
0
I think it is only create a element .How can I add a class to new element 😊
31st May 2017, 4:40 PM
Serhat Merak
Serhat Merak - avatar
0
txt=document.createElement("textarea"); txtDivi.appendChild(txt); How can I add a class and name to txt
31st May 2017, 4:49 PM
Serhat Merak
Serhat Merak - avatar
0
Thank you Maz 😊😊
31st May 2017, 4:58 PM
Serhat Merak
Serhat Merak - avatar