views:

33

answers:

2

Hi, I am trying to create an html element with one jquery plugin then pass the jquery object created to another plugin for more modifications. for example : 1 plugin would create the object the second one would add css ( i know this isnt the best way to do things) but a 3rd plugin calls the first one then the second one. I hope my description was clear :) thanks for your help

+1  A: 

Can't you use normal jQuery chaining ?

jQuery(myObject).firstThing().secondThing().thirdThing();
marcgg
I was thinking something more like this :$.fn.plugin1 = function(options) { //functionreturn jqueryobject}$.fn.plugin2 = function(options) { }$.fn.plugin3 = function(options) {object = $('selector').plugin1()$(object).plugin2() }this however isnt working
salmane
A: 

It depends a lot on the plugin code. Maybe you could give us an example.

Given your above description, the following may suffice:

$.thirdPluginFunc($.secondPluginFunc($.firstPluginFunc()));

//$.firstPluginFunc - Create the object
//$.secondPluginFunc - Apply the CSS
James Wiseman