Well, jQuery does not always assist in cutting code.  For example:

$("a").each(function() {
console.log( this.href, $(this).attr("href") ); // these produce equal values
});

When dealing with element attributes, it is often faster and cleaner to just use plain 'ol javascript. Don't let this dissuade you from using jQuery. In most cases it will save you lots of time and effort.

-- Josh


----- Original Message ----- From: "Chuck" <[EMAIL PROTECTED]>
To: "jQuery (English)" <jquery-en@googlegroups.com>
Sent: Monday, April 28, 2008 3:17 PM
Subject: [jQuery] Re: checked attribute of radio buttons not handled nicely in 1.2.3



No, but....

I am generating XML to send to my server.  I was replacing what was
basically

var xmlString = "<foo state="' + document.all.ProtectLocal.checked +
'"/>';

with

var xmlString = "<foo state="' + $('#ProtectLocal').attr("checked") +
'"/>';

Because I like the jQuery way of specifying items.  And the above
makes more sense then what is actually needed:

var xmlString = "<foo state="' + $('#ProtectLocal').attr("checked") ?
true : false + '"/>';

jQuery makes my code so much more readable and allows me to remove a
lot of existing JavaScript, this would be the first time it resulted
in more JavaScript to do the same thing.

-= chuck

Reply via email to