Skip to content Skip to sidebar Skip to footer

JQuery: Writing Jquery In An Object Oriented Way

I am trying to write all my query code in an object oriented way. But I don't know how to implement this for each click function and hover function etc. I also wanted to know: Wha

Solution 1:

Two counter-questions, that may help you deciding how to proceed on this:

  1. Why do you want to do this? Is it because you've recently learnt that OOP is great, and you want to use it everywhere, or do you have a specific reason for writing OO jQuery? Remember: Just because a technology (such as jQuery) or methodology (such as OOP) is great sometimes, or even most of the times, it's not great all the time.

  2. How (and why) would you write OO javascript? Don't forget that jQuery is just a library extending the javascript language, nothing else. Many times, the same rules and reasoning apply for javascript with jQuery as for javascript without jQuery.


Solution 2:

As others have mentioned, a little more information on what you are trying to accomplish would help us provide more specific information, but the javascript module pattern might be of interest to you as you learn.


Solution 3:

Not sure what you're asking, jQuery is inherintly object oriented to some degree, using Json and other structures help? Is it possible to give examples that are letting you down with regards OO.


Post a Comment for "JQuery: Writing Jquery In An Object Oriented Way"