Reputation: 3616
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?
Upvotes: 4
Views: 18484
Reputation: 26607
it seems you're using jQuery, so you can do something like :
column.attr('align', 'right');
Upvotes: 10
Reputation: 83203
Judging from the $
selector, you are using jQuery.
In that case, column
is not a DOM element, but a jQuery selector result, and you have to treat it accordingly:
$(column).attr('align', 'left');
Upvotes: 0
Reputation:
Looks like you're using jQuery? Use column.attr('align', 'whatev')
or better yet, use CSS.
Upvotes: 0