开发者

Attaching external style sheet [or list of css style rules] to a fragment of html loaded via Ajax method

What's the ideal way of attaching an external style sheet [or a relatively long list of style rules] to a fragment of HTML Loaded dynamically via the jQuery Ajax call? I'm aware the jQuery css method allows one to specify key:value pairs which translate to CSS attribute value pairs, but find it would take quite a block to declare a long list of rules in that format.

Context:

I have a jQuery UI dialog box, that pops up [AJAX] with a table using the [DataTables][1] paginat开发者_开发知识库ion feature. Now given Data tables comes with it's own set of Stylesheets, I'd like to apply the set to two style sheets to the tables in my Success call-back handler (*).

Is there a way of doing this or am I going down the wrong path?

Note:

I find that declaring the Data Tables style sheets directly in the head of my HTML document doesn't work when I invoke my dialog box? I therefore think I'd have to apply the style rules dynamically in my Success call-back handler.


The scope attribute of the html5 tag could help you out, but since its not a standard till now you have to go the old way and declare different styles for different classes and id's. Have you tried the jQueryUI ThemeRoller?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜