-1

I try to fix header table using this code CODE Here, but my real table id is:

<table id="table table-chrome table-striped wrapped-results  table-drilldown table-drilldown-cell"/>

So how can I change the Javascript to use that?

Brian Tompsett - 汤莱恩
  • 5,195
  • 62
  • 50
  • 120
appsofiane
  • 83
  • 1
  • 7

1 Answers1

1

Here is an updated fiddle: http://jsfiddle.net/3q8py094/

Create a new variable:

var querySelector = 'table[id*=drilldown]';

and then replace every reference to #maintable with querySelector

Dan

Dan Schalow
  • 128
  • 11
  • Alternatively use the ID `#table-container` and reference `nextElementSibling` or the next element which is a ``
    – Dan Schalow Jun 16 '16 at 09:25
  • 1
    yes thx can i do the same method if table-container contain random digit? like that table-container-345 , table-container-163 – appsofiane Jun 16 '16 at 09:25
  • That's it. `*=` basically means 'includes' and `^=` means starts with and `$=` means ends with. So, `div[id^=table-container]` means `
    ` with and `id` which starts with `table-container`. Take a look here: http://stackoverflow.com/questions/8714090/queryselector-wildcard-element-match
    – Dan Schalow Jun 16 '16 at 09:28
  • Feel free to 'accept' my answer, if you use it. I still can't comment elsewhere :P – Dan Schalow Jun 16 '16 at 09:31