2

I recently came across the includeMany jQuery plugin to include external JavaScript and CSS files into a page. Although it was released in early 2009 there are NO references in blogs or elsewhere. I wonder if it's usable? What is the experience using it?

2 Answers 2

5

You can include JavaScript and CSS using the example below. There is no need for any plugins.

To include JavaScript code, do this:

$.getScript("youpathtoscript.js",function() {
            //this script is loaded
});

To include CSS files:

$("<link/>", {
   rel: "stylesheet",
   type: "text/css",
   href: "styles/yourcss.css"
}).appendTo("head");
Sign up to request clarification or add additional context in comments.

Comments

0

For collection of CSS/JavaScript import (including):

Eval alternative:

$("<script></script>", {type: "text/javascript",})
.text("alert('your function');")
.appendTo("head");

Embedded CSS:

$("<style></style>", {type: "text/css",})
.text("#you{css:rule}")
.appendTo("head");

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.