Is JQuery here to stay?

Hey guys,

I have been learning JQUERY for a few months now and I am putting an awful lot of time into it. What I want to know is, is JQUERY going to be here to stay and therefore worth mastering ?

Although I speak several other languages, I am having to concentrate heavily on remembering the order or all of the sqaure brackets, round brackets, colons and semicolons in its syntax. This becomes increasingly complex as you start chaining effects, especially those with callback functions. Does anyone else struggle with this and how did you overcome it? Any tips or methods?

thanks kindly

Will

jQuery should be around for a very long time.

As for learning it syntax, there is 2 main components. There is Javascript, and there is Selectors.

If you don’t already know, jQuery Selectors are based off CSS selectors. This is independent of your JavaScript skills.

With practice, you’ll master both.

There is also plenty of articles, tutorials, documentation, example source code and books about JavaScript and jQuery to help you along the way.

You know I see jQuery as a very good opportunity to build in some animation if needed, but nothing more. It is good, that it is around, but It should not be one of the main ingredients of your site.

Never a bad idea to master a certain language, though :slight_smile:

I can’t say jQuery will last for a long time, however I can say jQuery like features will be inherited w/ other popular Javascript Framework. For example, “ExtJS” is a great example. It basically, has all the functionality of jQuery and their own unique features as well. So, by using this I was able to quickly learn it’s syntax it’s fairly similar to jQuery.

If you’re curious why I moved on from jQuery to ExtJS is the… UI libraries and data communication features. Let say, you have a CRUD on a table structure and Read-only pie chart or something. It standardizes the part where javascript communicates w/ the server side… meaning, I can use the same instance of data store that’s used in table and charts. Of course, jQuery can do this easily as well but most often you’ll rely on jquery plugins that outputs table or chart…which probably has different mechanism to read/create/edit/delete ajax. Well, I can be wrong since I haven’t used jQuery for a while…for now I’m completely happy w/ ExtJS!

That’s just very sad statement… use only for animations? if you ever have a need for DOM manipulation, I would never choose to create my own dom crud soup code… jQuery is awesome at DOM manipulation… such a sad statement…

If you learn JavaScript properly then you should only need to learn a small amount extra to use ANY JavaScript framework.

Thanks to you all for your advice and help :slight_smile:

Will

I’m a sad person :injured:

Indenting, and closing your brackets when you start, help a lot here.

For example, when creating a functions to handle a hover event:


$('#nav a').hover(

);

I put the functions in place, with both the start and end brackets


$('#nav a').hover(function () {

}, function () {

});

and then from there do I carry on with the internal content of the function.

That way I don’t need to later on try and put the closing brackets and parenthesis in the right order.
You can apply that technique to all bracketed blocks of code, whether they be if statements, functions, literal objects, etc.

Thanks for that , very helpful! :slight_smile:

Don’t write sloppy, unreadable code. JQuery promotes some very unreadable things. Method chaining is good in moderation but it can quickly get of of control. Also, promoting gigantic blocks or nested functions is another one that gets on my nerves. None the less, there isn’t much to learning JQuery once you understand JavaScript. Though, the same can not be said the other way around. If your going to invest time in JavaScript I would recommend learning JavaScript than moving to JQuery. If you understand JavaScript jQuery can be put to practice in a few hours, really there isn’t much to it.

The main things are event handling, DOM manipulation, selectors and AJAX. Everything else is just a build up of those things in addition to understanding fundamental principles such as; scope, binding, closures, etc. Without understanding some of the fundamental concepts all you’ll ever be able to do with JQuery on your own is copy others code, apply a plug-ins and be a complete slave to the way jQuery does things, regardless of whether or not its the best way given a certain circumstance. Not to mention follow the lack-luster pattern of cramming 1000+ lines of code into a single function, with worthless comments if any.

There are already enough under qualified JQuery tools producing horrendous code, because they lack any fundamental understanding - don’t be one of those.

You can break your statements like:


$('a').click(function() {
    $(this).fadeTo( 300, 0.5, function() {
                  alert( 'faded!' );
              })
              .next().hide()
               .end()
                .remove();
});

Well, be sure to explain your style if you work with multiple developers.

Thanks for all the advice on this topic guys
:slight_smile: