Must jQuery be verbose? -


i see lot of jquery code this:

if $('#contactme').attr('checked') {     $(':radio').attr('disabled', false) } else {     $(':radio').attr('disabled', true) } 

...but why not way:

var checked =  $('#contactme').attr('checked'); $(':radio').attr('disabled', not checked); 

...or way:

$(':radio').attr('disabled', not $('#contactme').attr('checked')); 

is not possible, or considered ugly/hard maintain?

update

to assertion "not" should "!" (a la c#, etc.), this:

http://jsfiddle.net/uvxha/

...where works jqueryui-ify button:

$("button:not(:ui-button)").button(); 

...but this:

$("button:!(:ui-button)").button(); 

...does not (or should say, "does !")?

you can that, long use ! , not not.

$(':radio').attr('disabled', !$('#contactme').attr('checked')); 

this has nothing jquery, it's how people write things.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -