Moving from Examples to my Project
Moving from Examples to my Project
GMGraying
Posts: 12Questions: 6Answers: 1
Since I am new at this, I have found it easier to use the examples to do with I need and have been using #example for the table name each time. Now that I want to change #example to my table name, nothing works. Where does 'example' need to be changed so that I can use my own table names?
Many thanks for any responses.
This discussion has been closed.
Answers
Its the table id. In many of the examples you will see:
The
#
is a jQuery ID selector, so it is just selecting the element with that id (jQuery docs). So to change example to something else you need to change the id in the HTML and the id in the selector.Regards,
Allan
Yes. This is basic info that I know. What I am trying to say is that if I change the table name (AKA id) to something other than example, it all breaks.
Can you include the code you're using to initialize datatables?
Example.
If you have a live example, even better.
I've just put together this little example. I've used an id of
allan
and simply changed the selector and id attribute, and it works as expected.As Apezdr says, to understand why that isn't working for you, we'd need a link to a page showing the issue please or the full HTML and Javascript being used.
Thanks,
Allan