S
S.T.
Pherdnut said:It's useful to try and work without frameworks as much as possible
until you've really honed your JS skills and knowledge. But there
comes a point where you're just being obstinate and completely missing
the point of actually using a framework. I'm saying this to you
because I was in the exact same mental boat as you clearly are now
until recently when I signed on with an all JQ shop where they'd
really rather you didn't DOM script 800 lines when you could do it in
a handful of JQ statements which do not obscure what's actually going
on if you know both JS and JQ.
On the flipside of that coin, JQ is not a workaround for actually
learning JavaScript. If you don't know what's really going on behind
the scenes you can very easily write painfully slow code. It's a lot
like regular expressions. It's powerful enough that if you don't know
what you're doing you can cripple your performance with a single line.
That's a fair critique. I certainly use JQuery as a crutch. All things
being equal, I'd like to know all aspects of Javascript (ECMAscript...
whatever the purists want to call it these days) inside and out.
That said, all things aren't equal. Time spent learning the most
intimate details of Javascript is time taken away from generating
revenue or gaining knowledge of other technologies. And thankfully,
JQuery takes some of the more complicated and used JS concepts (DOM
selection and manipulation and Ajax/XHR) and substantially rounds out
the learning curve. Despite the doomsday predictions seen on this board,
the 'cons' of using JQuery have been trivial at best.
The opening of the DOM manipulation and Ajax to 'the masses' does, of
course, open the risk of poorly thought out coding.
Bloat is a risk for the true novices as well, particularly if they
simply add a slew of plugins (or worse, a complete JQueryUI script) to
accommodate relatively simple functionality. In this newsgroup however,
the 'bloat' argument seems to be in the context of the library itself.
I'd argue if you have a DOM so complicated so as to actually cause
JQuery to have perceivable performance issues, you'd be far better off
learning how to design a UI and/or page layout before bothering to learn
every facet of Javascript.
And for Garrett,
// checked checkboxes beginning with 'booking['
var i = $("input[name^='booking[']:checked","#myform").length;
// total checkboxes beginning with 'booking['
var j = $("input[name^='booking[']","#myform").length;
... where 'myform' is the ID of the form