Jump to content

Proper jQuery Usage

- - - - -

  • Please log in to reply
8 replies to this topic

#1
hetra

hetra

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 298 posts
  • Location:Australia
  • Programming Language:C, C++, PHP, Python, Delphi/Object Pascal, Assembly
  • Learning:Python, Assembly
Hello all,

I've been working on my site's UI lately. I've improved it majorly (more efficient, more simple, etc.).

However, I want to know if I should use jQuery, and if so, how much to use it, when to use it, etc.

I have installed jQuery, and it works.

Thank you.
Jack
Creator, Owner, Webmaster
Brezerd.net

#2
njr1489

njr1489

    Learning Programmer

  • Members
  • PipPipPip
  • 70 posts
jQuery is meant to make JavaScript with ease. You should use it if it interests you. There are other JavaScript libraries out there like JS Ext and MooTools which can accomplish the same thing which is why I say that. I use it because I can write JS code much faster.

#3
hetra

hetra

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 298 posts
  • Location:Australia
  • Programming Language:C, C++, PHP, Python, Delphi/Object Pascal, Assembly
  • Learning:Python, Assembly
So use jQuery whenever I would use JavaScript?
Jack
Creator, Owner, Webmaster
Brezerd.net

#4
njr1489

njr1489

    Learning Programmer

  • Members
  • PipPipPip
  • 70 posts
Essentially you could. I'm not saying do it and completely forget about JavaScript (some people actually do this and forget jQuery is simply a library of JavaScript), but do it when it makes your life easier. But then again, 99% of the time I use jQuery, it is much faster than if I were to write plain old JavaScript.

#5
hetra

hetra

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 298 posts
  • Location:Australia
  • Programming Language:C, C++, PHP, Python, Delphi/Object Pascal, Assembly
  • Learning:Python, Assembly
Okay then. However, since jQuery is essentially JavaScript, will this slow down load times?
Jack
Creator, Owner, Webmaster
Brezerd.net

#6
BlaineSch

BlaineSch

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,448 posts

Hunter100 said:

Okay then. However, since jQuery is essentially JavaScript, will this slow down load times?

Yes, it takes time to load the jQuery file, extra overhead since your jQuery funciton calls other functions.

However, it does make your code a ton cleaner, you can write code faster, so in most cases the benefits out weigh the slower load times, especially if you are already using it.

#7
njr1489

njr1489

    Learning Programmer

  • Members
  • PipPipPip
  • 70 posts
Well it depends what you write. I did hear though that jQuery will have less load times if you specify your selectors better. IE:
$('div#header')
would load faster than
$('#header')
because it singles out elements by narrowing down its targets. But here's definite help for making jQuery faster: 10 Ways to Instantly Increase Your jQuery Performance | Nettuts+

#8
hetra

hetra

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 298 posts
  • Location:Australia
  • Programming Language:C, C++, PHP, Python, Delphi/Object Pascal, Assembly
  • Learning:Python, Assembly
Thanks for the advice and that link.

But, do you think the end-users might grow tired of too much JavaScript (whether it is jQuery, Moo Tools, Prototype, etc.)?

All my other questions have been answered though, so thank you.
Jack
Creator, Owner, Webmaster
Brezerd.net

#9
njr1489

njr1489

    Learning Programmer

  • Members
  • PipPipPip
  • 70 posts
Maybe if you cram your pages with unnecessary effects, actions, etc. that do nothing for the user to accomplish their task (like adding annoying dialog boxes for the hell of it), then yeah. Otherwise, I find it really useful as these JS libraries can help me build pages that are dynamic, content-driven, etc. without moving from page to page so much.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users