Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to dynamically set align property for td in javascript?

Here is my code, my question is in the comment:

function (align) {    
    var column = $(`'<td>'`);  
  // now i need syntax to set align property to this td element  
  // column.align = align (not working)  
}

As shown, column.align = align is not working.

Where am I going wrong?

like image 385
JAB Avatar asked Dec 21 '22 17:12

JAB


1 Answers

it seems you're using jQuery, so you can do something like :

column.attr('align', 'right');
like image 98
krtek Avatar answered Mar 04 '23 01:03

krtek