I load the file into a div with the load () function, but after loading the data - the styles for it do not want to work.
For instance:
index.html
$("a ").click( function(e) { e.preventDefault(); $("#Display").load('file.html'); $("#Display").show(); });
file.html:
<h1 id="title">Item number #1</h1> <p id="content">Lorem ipsum like text...</p>
style.css:
#title { color: red; } #content { color: green; }
After I click the βaβ link, the content is loaded into the #Display div, then it will display fine, but the title of the title does not blush, and the paragraph of the content is not green .
I believe that the default behavior is because when the site first loads, there are no such elements, and I load them dynamically using jQuery. Is there a way to lazily load them and somehow update the stylesheet in the background? Or any other tricks that will help me?
Thanks a lot!
source share