Damir
Damir

Reputation: 56199

Is in JQuery something similar Class in Mootools

Is in JQuery something similar Class in Mootools ? I need to create one base class Element and then to derive couple specifications of that elements( example Element_1 and Element_2). How to achieve that using JQuery ?

Upvotes: 0

Views: 311

Answers (1)

Thomas Menga
Thomas Menga

Reputation: 1858

Do you mean OOP with jQuery ? You can't. You can extend jQuery but you can't write your own Classes using jQuery.

You have 3 solutions there:

  1. Extend jQuery with a plug-in
  2. Write a JSON object (but this won't be a real JavaScript Class, just a bunch of functions you can have with a namespace)
  3. Use some plugins that will help you creating Classes with jQuery (e.g http://code.google.com/p/jquery-inheritance/ or http://jupiterjs.com/news/a-simple-powerful-lightweight-class-for-jquery or https://github.com/taylanpince/jquery-class/)

More infos: OO JQuery and classes

Upvotes: 1

Related Questions