Hi,

I have to add css attribute at runtime using jquery..
For example i have the following code:

<table width='100%' cellpadding='0'  cellspacing='0' >
    <tr>
      <td valign='top' width='70%'><span class='header-text'> </span> </td>
    </tr>
  </table>

I need to add css style to the table. I can access span element of td within table. From that how do i get table element.

Help immediately required.

Thanks,
VC

Recommended Answers

All 3 Replies

Member Avatar for soUPERMan

i think
$(this).find('table');
or you could give your table a class/id and get it like this
$('.tableClass'); or $('#tableID');

Or you could try something like this.

$("table").css({'background-color': '#ffe', 'border-left': '5px solid #ccc'})

Thanks guys.. That worked :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.