This plugin is incredibly simple — it takes a block of code and evaluates it. That’s it! But, it has a cool application when you’re showing casing code and plugins. Instead of duplicating code in the header and then when you give examples to the user, you simply just run the example code.
This page isn't probably the best showcase of such a plugin, but you can see it in action if you view one of
my jQuery plugins. The examples are run through the plugin, which in turn
makes each <code> block within the example in to its working code.
Below is the code used to run the examples:
$('code.javascript').runcode();
Download…
Want to use “Run Code” on your own website? No problem. You can download the full version.
Write Your Own…
Want to write your own plugin? I start all my plugins with a simple “skeleton” wrapper. Simply download my jQuery Plugin Skeleton and get started.