Make TABLE TH element's innerHTML vertical


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function vert (elem) {
  2. var el = document.getElementsByTagName(elem);
  3. for (var i=0; i < el.length; i++) {
  4. var ex = el[i].childNodes[0];
  5. if (el[i].nodeType === 1) {
  6. el[i].innerHTML = el[i].innerHTML.split('').join('<br/>');
  7. };
  8. };
  9. }
  10.  
  11. vert('th');

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.