0


I have two divs with ID #container.

In first one is class .current-content
[div#container -- div.current-content]

The second one is contained in class .next-content and contain class current-content
[div#container -- div.next-content -- div#container -- div.current-content]

Is possible to have only one #container with class .current-content with elements from second .current-content?
Eventually how do that?
Thanks. :)

  • 5
    HTML `id` attributes are supposed to be unique, so you may not have two different elements with the same id. – Itay Feb 23 '14 at 20:59
  • http://stackoverflow.com/q/11114622/601179 – gdoron Feb 23 '14 at 21:01
  • I know, but i have div.next-content in which im loading data from next HTML file. How can i fix this? – user3316061 Feb 23 '14 at 21:01
  • Maybe you could pre-load the content in an iframe and copy it across from there... tbh I'm not to sure how dom elements behave cross frame though... – major-mann Feb 23 '14 at 21:04

1 Answers1

0

Each id value must be used only once within a document. If more than one element has been assigned the same ID, queries that use that ID will only select the first matched element in the DOM. This behavior should not be relied on, however; a document with more than one element using the same ID is invalid.

from http://api.jquery.com/id-selector/

bbuecherl
  • 1,609
  • 12
  • 20
  • Thanks. :) Problem is, that I have html documents with same DOM [body-div#container-div.currentcontent] and i want load only #container contentfrom second one to temp div.next-content in first div#container. – user3316061 Feb 23 '14 at 21:06