Sevren
Sevren

Reputation: 331

DataTables multiple styles on multiple tables in one page

I am new to datatables and needed to get mutliple datatables working in the same page I found a online JSBIN of the multiple tables so i can play around with the styling..

Here is the forked JSBIN demo http://jsbin.com/qawota/1/edit

I am trying to have multiple styles applied to the diffrent headers of the tables. For example the inner most table i would like to change the headings to have colored backgrounds etc.. anything to make it look diffrent so it is not confusing to people using the table

I have given the inner table an id of example1 and a class of innerDataTable but in the css writing something like .innerDataTable or trying to select with the id has no effect.

Thanks

Upvotes: 2

Views: 946

Answers (1)

emmanuel
emmanuel

Reputation: 9615

You could use Jquery .css() to change css styling of the page.

I have updated your example adding a button that onClick changes heading background.

Html:

<a id="change_style" onClick="change_style();">Change style</a>

Js:

function change_style() { 
  $('#example tr[role="row"]').css('background','red');
}

JSBin: http://jsbin.com/forenisedevu/1/edit

Upvotes: 1

Related Questions