0

Am trying to populate a div in my webpage with some child divs that are created dynamically. The datasource for these child divs is an xml file. The data from the xml are well inter preted and the divs are getting shown in the page. The problem is that CSS classes and styling are unavailable for these divs after loading. Am using jquery and an ajax call to parse the xml file and jquery's append method to create the child divs dynamically. Any help appreciated.

1
  • Yes, and use jsfiddle.net if possible. Commented May 9, 2011 at 13:38

1 Answer 1

1

It is not working to apply some .css() statement to your target container downstream in your code after calling the append() function.

I guess you would have to .bind() it somehow, but since there is no callback-function (... I think) like with .load() I can't see how to do that.

However there is a solution to your problem !!!

Just define classical css (... in your html-header or by linking a css-file). The styles you define there are applied to dynamical content added via .append()

... I guess that's not exactly a pure jQuery-solution, so if there is a way of applying .css() to a container after .append() please let us know :-)

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.