Topic: stuck...again... working with jQuery |
|
---|---|
Author | Thread |
Lunatic (VI) Inmate From: under the bed |
posted 06-22-2009 17:08
Hi guys code: $("#cal-all").click(function(){ if($(this).attr("checked" == true)){ $("#cal-all").attr("disabled", "disabled"); $("#cal-head input:not(#cal-all)").attr("checked", "checked"); $("table.calendar div").show(); } }); $("#cal-head input:not(#cal-all)").click(function(){ var classMatch = $(this).attr("id"); if($(this).attr("checked" == false)){ $("div." + classMatch).hide(); $("#cal-all").attr("checked", ""); $("#cal-all").attr("disabled", ""); } else{ $("div." + classMatch).show(); } });
|
Paranoid (IV) Inmate From: London |
posted 06-22-2009 17:37
I've tried a similar method in the past, what I've found is that you can't concatenate strings in the $() statements. code: else { var my_obj = "div." + classMatch; $(my_obj).show(); } |
Lunatic (VI) Inmate From: under the bed |
posted 06-22-2009 18:16
Thanks. I gave it a shot, but no luck. |
Lunatic (VI) Inmate From: under the bed |
posted 06-22-2009 20:58
Ok, I went with a sightly different approach: instead of an if/else, I use the if to check for "checked" so I can still tweak the state of the checkboxes, but I use slideToggle() to show and hide the div's - code: $("#cal-head input:not(#cal-all)").click(function(){ var classMatch = $(this).attr("id"); if($(this).attr("checked" == false)){ //$("div." + classMatch).hide(); $("#cal-all").attr("checked", ""); $("#cal-all").attr("disabled", ""); $("label[for=cal-all]").removeClass("disabled"); } $("div." + classMatch).slideToggle("fast"); });
|
Maniac (V) Mad Scientist with Finglongers From: Germany |
posted 06-23-2009 10:14
now, this might be some kind of weird javascript/jquery 'quirk', code: if($(this).attr("checked" == false)){
code: if($(this).attr("checked") == false){
|
Lunatic (VI) Inmate From: under the bed |
posted 06-24-2009 14:25
Oh, dammit! |
Nervous Wreck (II) Inmate From: |
posted 05-31-2011 11:07
Edit TP: spam removed
|