[jQuery] Re: Creating plugins

2007-12-13 Thread Eridius
Yea, i guess your right. jQuery has grown on me the past few month and know I would why I wanted to use mootools instead. Dan G. Switzer, II wrote: > > >>> guess) it a pain. the javascript class code structure it also very >>akword >>> to be coming from a C++ background. >> >>Amen, and i ha

[jQuery] Re: Creating plugins

2007-08-13 Thread Dan G. Switzer, II
>> guess) it a pain. the javascript class code structure it also very >akword >> to be coming from a C++ background. > >Amen, and i had the same hurdle to climb, but JavaScript isn't C++. It >uses a completely different type of OOP. These articles may be helpful >in understanding it: > >Implement

[jQuery] Re: Creating plugins

2007-08-12 Thread Stephan Beal
> guess) it a pain. the javascript class code structure it also very akword > to be coming from a C++ background. Amen, and i had the same hurdle to climb, but JavaScript isn't C++. It uses a completely different type of OOP. These articles may be helpful in understanding it: Implementing class

[jQuery] Re: Creating plugins

2007-08-12 Thread Eridius
Well i think i would one thing that might make me stay with jQuery and that is the selector. I think the selector in jQuery is much better than mootools, the class thing is something i can work around. Ganeshji Marwaha wrote: > > Eridius, > > Whatever u choose is upto u, but i just want u to

[jQuery] Re: Creating plugins

2007-08-12 Thread Eridius
Well i did getting it working with plain javascript. I have tried to get into jQuery this weekend and it is just not working. I mean i was able to create a ajax_request and paginator script using mootools with 4-5 hours and just getting a simple class with mootools(or without i guess) it a pain

[jQuery] Re: Creating plugins

2007-08-12 Thread Byron
you probably want somthing like, jQuery.ajax_request = { ajax_options : function () { test: 'test' }, test : function() { alert(this.test); } } im guessing...

[jQuery] Re: Creating plugins

2007-08-12 Thread Ganeshji Marwaha
Eridius, Whatever u choose is upto u, but i just want u to be make a clear and informed decision... Anyways, the demo now will reflect creation of class outside $(function()) method. I guess, u just have to try a bit more, coz every new language or framework has its ways of doing things, and it t

[jQuery] Re: Creating plugins

2007-08-12 Thread Eridius
That does no achive what i want. I can only declare and instance of the class inside the $(function()) which does not help me becuase i might want to declare X amount of the with different names. I guess maybe jQuery is not what i am looking for, i mean jQuery seems to have poor OOP support whe

[jQuery] Re: Creating plugins

2007-08-11 Thread Eridius
ok, cool thanks for the help and to make sure i understand that code, the first part is basically the constructor and the second part(the .prototype) is adding all the members/methods to the class, right? Ganeshji Marwaha wrote: > >>> why do i get error saying that test is not a function of t

[jQuery] Re: Creating plugins

2007-08-11 Thread Ganeshji Marwaha
>> why do i get error saying that test is not a function of t? Because you are approaching it wrong. This is how u can achieve what u want to $.ajax_request = function(options) { this.options = {test: "test"}; } $.ajax_request.prototype = {

[jQuery] Re: Creating plugins

2007-08-11 Thread Eridius
ok here is my code: jQuery.ajax_request = function(options) { ajax_options = { test: 'test' }; test = function() { alert(this.test); } } var test = $.ajax_request(); test.test(); why do i get error saying that test is not a function of t? Ganeshj

[jQuery] Re: Creating plugins

2007-08-11 Thread John Resig
I'll follow up here as well: To write a class how you like, you could do it like this: function ajax_request(options){ // initialize this.setOptions( options ); } ajax_request.prototype = { // members and properties setOptions: function(options){ this.options = options; } }; That's the

[jQuery] Re: Creating plugins

2007-08-11 Thread Ganeshji Marwaha
When you create a plugin that will be executed on a selected set of DOM elements, you use jQuery.fn.myPlugin = function() {} When you create a plugin that is going to be executed statically, like $.ajax, you create it like this. jQuery.myPlugin = function() {} Effectively, jQuery is an instance