0

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() {
  }

1 Answer 1

1

Instead of using

table = $('table');

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

table = $("#example");

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.