Here is my code, my question is in the comment:
function (align) {
var column = $(`'<td&开发者_如何学Pythongt;'`);
// 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?
it seems you're using jQuery, so you can do something like :
column.attr('align', 'right');
Try this one:
$(column).attr("align","left");
Looks like you're using jQuery? Use column.attr('align', 'whatev')
or better yet, use CSS.
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');
Try this, myTD.setAttribute("align", "right");
精彩评论