My HTML has
cell = document.createElement('td'); cell.appendChild(document.createTextNode(contents)); cell.setAttribute('width', '100');
The following syntax is not working.
cell.appendChild(document.createElement('br')).appendChild(document.createTextNode('Another text'));
And after the contents of the cell, I have a line break followed by another text in small letters in same cell. How can I do it?
It looks like you are trying to chain your method calls… Sorry! No chaining for native elements. If you want chaining then try jQuery, otherwise try:
You’ll have to add some css to style that span to have smaller text:
Or you could just modify the style of that element instead of using the className: