user240141
user240141

Reputation:

Applying align attribute to table header using Jquery

I know to apply css to DOM using jquery using .css() , I want to know is there any .attr or .att method so that I can assign align attribute to table header using jquery. If yes please show me the code.

<table>
<th >
</th>
<th >
</th>
<th >
</th>
</table>

Upvotes: 0

Views: 1018

Answers (3)

JohnnBlade
JohnnBlade

Reputation: 4327

Here is a sample code $(element).attr("nameAttr",valueAttr); like this you can add any attribute to any html element

Upvotes: 1

TheVillageIdiot
TheVillageIdiot

Reputation: 40517

Tough you should try CSS to set alignment but still jQuery does provide with attr function like:

$("th").attr("align","left");

Upvotes: 0

COLD TOLD
COLD TOLD

Reputation: 13599

i am not sure if that what you are looking for but you can add atribute to th like this

$("th").attr("align", "left");

Upvotes: 0

Related Questions