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开发者_如何学C_2). How to achieve that using JQuery ?
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:
- Extend jQuery with a plug-in
- Write a JSON object (but this won't be a real JavaScript Class, just a bunch of functions you can have with a namespace)
- 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
精彩评论