How to Use a Plug-in
Using a jQuery plug-in is very straightforward. The first step is to include it in the <head>
of the document, making sure that it appears after the main jQuery source file:
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8"/>
<script src="jquery.js" type="text/javascript"></script>
<script src="jquery.plug-in.js" type="text/javascript"></script><script src="custom.js" type="text/javascript"></script>
<title>Example</title>
</head>
After that, it’s just a matter of including a custom JavaScript file in which we use the methods that the plug-in either creates or extends. For example, using the Form plug-in, we can add a single line inside our custom file’s $(document).ready()
method to make a form submit via AJAX:
$(document).ready(function() { $('#myForm').ajaxForm(); });
Many plug-ins have a bit of built-in flexibility...