7.1

Table Of Contents
DOM manipulation using jQuery
jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax
interactions for rapid web development. With the introduction of PrintShop Mail Web 2.x the jQuery library is part of the Print-
Shop Mail Web installation. Information about jQuery can be found at: http://www.jquery.com
The following sections describe the jQuery basics and give you helpful tips about how to use jQuery in PrintShop Mail Web.
Launching code on Document Ready
jQuery has a simple statement that checks the document and waits until it's ready to be manipulated, known as the ready
event. Inside the ready event you can add the code that you want to run right when the page is loaded.
<script type="text/javascript">
$(document).ready( function(){
//Your code here
});
</script>
You can add this Javascript code in the head section of the template.php file or create an external Javascript file. If an external
Javascript file is used make sure that it is added (inlcuded) in the head section of the template.php file. The following snippet
shows how to include a Javascript file (template-welcome.js) located in the folder of the skin.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><? generateSystemName(); ?>: <? generateTitle(); ?></title>
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<? generateCSSIncludes(); ?>
<? generateJavaScriptIncludes(false); ?>
<script src="<? echo generateSkinLocation() ?>/template-welcome.js"></script>
</head>
<body>
...
</body>
</html>
The following could be the content of the Javascript file.
$(document).ready(function() {
alert('hello world');
});
©2010 Objectif Lune Inc - 251 -