[jQuery] Re: Dynamic Variables

2008-02-15 Thread rsmolkin
Thanks everyone for great suggestions. I compbined some of these with some coldfusion to really condence down the code. -Roman On Feb 11, 7:32 pm, Karl Swedberg <[EMAIL PROTECTED]> wrote: > Hi there, > > You could do something like this: > > $(':checkbox').click( >

[jQuery] Re: Dynamic Variables

2008-02-11 Thread Karl Swedberg
Hi there, You could do something like this: $(':checkbox').click( function() { var idPart = this.id.split('_')[1]; if ($(this).is(":checked")){

[jQuery] Re: Dynamic Variables

2008-02-11 Thread Nate
If you had a consistent naming convention, I think something like the following would work: function setClick() { var id = ""; for(var i = 0; i < arguments.length; i++) { id = arguments[i]; $("#ckbx_"+id).click( function() { $(this).attr("checked") ? $("#opt_"+

[jQuery] Re: Dynamic Variables

2008-02-11 Thread Shawn
This is untried, but something similar should work out for you: function doIt(target) { var myid = $(target).attr("id").toString().split("_")[1]; var myelement = "table#" + myid; if ( $(target).attr("checked") ) { $(myelement).show(); } else { $(myelement).hide(); } } This m