[jQuery] Re: Functions and variables

2008-12-09 Thread brian

On Tue, Dec 9, 2008 at 10:12 AM, Will <[EMAIL PROTECTED]> wrote:
>
> Thanks.  I ready an article somewhere and it mentioned not combining
> "old" coding forms with new in reference to jQuery.  It didn't make
> much sense to me and this confirms it.  I'll continue to code with
> functions and such and just supplement with jQuery where beneficial.

Again, if you have any specific code that you can post, maybe someone
could help you refactor it.


[jQuery] Re: Functions and variables

2008-12-09 Thread Will

Thanks.  I ready an article somewhere and it mentioned not combining
"old" coding forms with new in reference to jQuery.  It didn't make
much sense to me and this confirms it.  I'll continue to code with
functions and such and just supplement with jQuery where beneficial.

Thanks

On Dec 4, 6:36 pm, "Michael Geary" <[EMAIL PROTECTED]> wrote:
> jQuery isn't a separate language with its own rules. It's still JavaScript
> code, just like any other JavaScript code. Functions, variables, reusable
> code, those are all good practice, and none of it changes because you're
> using jQuery.
>
> Could you give a specific example of some jQuery code that doesn't look
> good, and then we can talk about how to clean it up?
>
> -Mike
>
> > From: Will
>
> > I'm sure this is dealt with somewhere in the jQuery tutorials
> > but I have not been able to find it.
>
> > I'm new to jQuery and used to working with functions and
> > variables so that I can create reusable code and not have to
> > hard code every event that could happen.  This is pretty much
> > basic programming.  For Example,
>
> > function action(id) {
> >      //do something.
> > }
>
> > Short of using this method of traditionally programming is
> > there a better way of doing this in jQuery?


[jQuery] Re: Functions and variables

2008-12-04 Thread Michael Geary

jQuery isn't a separate language with its own rules. It's still JavaScript
code, just like any other JavaScript code. Functions, variables, reusable
code, those are all good practice, and none of it changes because you're
using jQuery.

Could you give a specific example of some jQuery code that doesn't look
good, and then we can talk about how to clean it up?

-Mike

> From: Will
> 
> I'm sure this is dealt with somewhere in the jQuery tutorials 
> but I have not been able to find it.
> 
> I'm new to jQuery and used to working with functions and 
> variables so that I can create reusable code and not have to 
> hard code every event that could happen.  This is pretty much 
> basic programming.  For Example,
> 
> function action(id) {
>  //do something.
> }
> 
> Short of using this method of traditionally programming is 
> there a better way of doing this in jQuery?



[jQuery] Re: Functions and variables

2008-12-04 Thread Max

Sorry...this question is a little ambiguous to me.  Can you be more
specific or give an example/use case?  I think you will have to "hard
code every event", because otherwise there's no logic dictating what
happens when, say, you click something.  As for defining actual
functions and reusable code...either use the regular code you have
there, wrap up your code in a regular JavaScript "class", or make a
jQuery plugin that's specific for your site.

Max

On Dec 4, 2:26 pm, Will <[EMAIL PROTECTED]> wrote:
> I'm sure this is dealt with somewhere in the jQuery tutorials but I
> have not been able to find it.
>
> I'm new to jQuery and used to working with functions and variables so
> that I can create reusable code and not have to hard code every event
> that could happen.  This is pretty much basic programming.  For
> Example,
>
> function action(id) {
>      //do something.
>
> }
>
> Short of using this method of traditionally programming is there a
> better way of doing this in jQuery?