Search code examples
jquery-uijqueryjquery-tabs

jQuery tabs with dynamic pages


I have a little problem with jQuery Tabs. I get it to work well. But when I open the pages dynamically (eg. I click to open a new tab for a product) it may be several tabs open to different products. But each side has of course the same id and so on (eg. div tags). This means that when I change something on another tab so it's affecting the other tabs.

How do you solve this problem?


Solution

  • You can use a scalar ID (1,2,3,4,5, ecc) for these DIVs and just store the "reference ID" in another field.

    The use of the same ID for different nodes is just a bad practice. It also breaks the validation of your document.

    Take a look at the .data() method on jQuery that allow you to store data in an arbitrary way