Anders Schneiderman schrieb:
> Hi JornjQuer,
> 
> As a newbie, my impression is that overall it's a _lot_ simpler and sleeker 
> than say prototype.  And I love the compactness of the language.  However, 
> there are a few aspects that will throw off new folks -- particularly graphic 
> designers who don't have a programming background -- that they encounter 
> right from the beginning.  If more advanced features, which few people will 
> use until they've been working in jquery for a while, seem a bit arcane, 
> that's OK.  But to do almost anything, you run into code that looks like this:
> 
> 1     $(document).ready(function(){
> 2             $("a#shownote").click(function(){
> 3                     $('#note').fadeIn("slow");
> 4             });
> 
> The first time I saw line 1, I had no clue what it was doing.  If all it's 
> doing is running some jquery before the page is loaded, there's _got_ to be a 
> more intuitive, succinct way to say it.
> 
> Ditto for line 2's click(function().  If I know CSS, I can guess what 
> a#shownote does.  I can guess what click does.  But function() { is just too 
> frikin' weird for a newbie designer who's not been a programmer.  
> 
> Readability for people who are relatively new is particularly poured in for 
> the world of JavaScript. 

Hi Anders,

although it seems to be a coding style most jQuerians have adopted, no 
one hinders you to do the following:

function showNote() {
     $('#note').fadeIn("slow");
}

function init() {
     $("a#shownote").click(showNote);
}

$(document).ready(init);

Of course you still have know that you have to pass a function reference 
of some kind to click() and the like, but if you want to use an API you 
should get familiar with it by reading the documentation to a certain 
extend, be it a designer or a programmer. Fortunately jQuery has a 
pretty good documentation.


-- Klaus

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to