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

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -