Actions

Install jquery

From zen2

Installing jquery in Typo3

First - you MUST install Javascript Manager first jsmanager

Only after you have done this can you install jquery

Once installed place the following line in you extension, right after the first require_once

require_once(t3lib_extMgm::extPath("jquery")."class.tx_jquery.php");

This may not be that latest version. Download jquery from the jquery websit, and overwrite the jquery.js file in /var/www/t3/typo3conf/ext/jquery/src

Adding extra scripts

Ensure you give the script the .js extension, rename it cutting out any jquery. prefix (unnecessary, but most of the other scripts don't have it) and put it in the jquery plugins folder. I don't think it matters if it's uncompressed - I think jquery requires help to use the "uncompressed plugins" folder, so just skip that. Ensure you have any prerequisite scripts also installed! Copy the CSS as you see fit. It can all go in the main CSS file in filadmin/templates - probably not the optimal way, but it works.


Defining the scripts you will use

Decide which scripts you will need, and include them in your extension thus:

function main($content,$conf){
// only include the scripts, that are necessary
tx_jquery::setPlugins(array('iutil','idrag','idrop','isortables'));
tx_jquery::includeLib();

Using the scripts

First, ensure you have put an id= in your field. Some class= probably helps too.

$firstList = '<ul id="firstlist">';

or

<input id="date-pick" class="dp-choose-date" type="text" size=6>

Before the script finish start a new line. I think this is necessary, but not 100%.

. '</div>' . "\n";

Then put in the script: (Watch for 66-99 quotes in the jquery example - they are wrong!)

$content .= '<script type="text/javascript">' . "\n";

. '// <![CDATA[' . "\n"

. "$('#firstlist').Sortable({accept:'sortable', fit:true, tolerance:'intersect', floats:false});" . "\n"

. "$('#secondlist').Sortable({accept:'sortable', fit:true, tolerance:'intersect', floats:false});" . "\n"

. '// ]]>' . "\n"

. '</script>' . "\n";


Examples

jquery date picker

tablesorter