yassine j
yassine j

Reputation: 515

Laravel | Javascript | Select specific html table in the blade

I have javascript code that selects data in all tables existing in my Laravel blade.

I would like to apply this code only for a specific table with id="exemple". How can I accomplish that?

My javascript code :

<script>
  function groupDataByDate() {
    var columns, columnOrder, data,
    table = $('table'), mainObj = {};
    columns = [{
      title: 'date',
      values: [4,9]
    }];

    table.find('tbody tr').each(function() {
  }

Upvotes: 0

Views: 246

Answers (1)

Tim Lewis
Tim Lewis

Reputation: 29278

Instead of using

table = $('table');

which targets all <table> elements in your HTML, use

table = $("#example");

To only target an element with id="example".

Upvotes: 1

Related Questions