Random Content Generator
- Powered by jQuery (and Chuck Norris)
Click here to download jquery.randomContent.js v.1
The jQuery Random Content Generator takes placeholder text to the next level by randomly inserting text of varying sizes from an XML file. The random content is appended to any element that has the specified class name.
See the plugin in action by refreshing the page (f5).
There are two parameters that can be passed into this plugin. xmlPath, obviously, takes the path to the XML file that has been prepared with filler text. nodeName specifies which XML node(s) the content will be pulled from. This is done so that multiple types of content can be stored in one XML file. For example, you can use two different node names to distinquish between short and long content and attach them to two different class names.
To use this plugin, use the following code (you will want to ajust the classname and XML file info to meet your needs):
The defaults for these are xmlPath: "randomContent.xml", nodeName: "content"
The XML structure is very simple. Just one parent node with all its children inside. Like this:
Enjoy :)