Mike, Your $isCustomizedIops is something like:
<div class="form-item"> <div class="name"> <label>Custom disk iops</label> </div> <div class="vale"> <input type=checkbox" checked="checked"> </div> </div> So, if you want to know whether the checkbox is checked or not, you should use "($isCustomizedIops.find('input[type=checkbox]').is(':checked')" instead of "($isCustomizedIops.is(':checked')" Jessica -----Original Message----- From: Mike Tutkowski [mailto:mike.tutkow...@solidfire.com] Sent: Wednesday, November 06, 2013 10:10 AM To: dev@cloudstack.apache.org Subject: Re: JavaScript Question This is just a guess, but I'm thinking if the checkbox is not visible, then ":checked" always returns false (which would be weird). I do make the checkbox visible before using ":checked", but it's possible this visibility change doesn't take effect until after the event handler finishes. Any thoughts on this from people who do a lot of JavaScript (or anyone else, of course). :) $isCustomizedIops.css('display', 'inline-block'); if ($isCustomizedIops.is(':checked')) { $minIops.hide(); $maxIops.hide(); } else { $minIops.css('display', 'inline-block'); $maxIops.css('display', 'inline-block'); } On Tue, Nov 5, 2013 at 10:50 PM, Mike Tutkowski < mike.tutkow...@solidfire.com> wrote: > Hi, > > Does anyone know why this checkbox of mine always returns false? > > if ($isCustomizedIops.is(':checked')) { > // do some stuff > } > > That code is part of an event handler for a combobox (when the combobox > changes to a certain state, I want to see if the checkbox that is revealed > is in the checked state): > > args.$select.change(function() { > var $isCustomizedIops = $form.find('.form-item[rel=isCustomizedIops]'); > > if ($isCustomizedIops.is(':checked')) { > // do some stuff > } > } > > The checkbox is set up like this: > > isCustomizedIops: { > label: 'label.custom.disk.iops', > docID: > 'helpDiskOfferingCustomDiskIops', > isBoolean: true, > isReverse: true, > isChecked: false > }, > > Thanks! > > -- > *Mike Tutkowski* > *Senior CloudStack Developer, SolidFire Inc.* > e: mike.tutkow...@solidfire.com > o: 303.746.7302 > Advancing the way the world uses the > cloud<http://solidfire.com/solution/overview/?video=play> > *(tm)* > -- *Mike Tutkowski* *Senior CloudStack Developer, SolidFire Inc.* e: mike.tutkow...@solidfire.com o: 303.746.7302 Advancing the way the world uses the cloud<http://solidfire.com/solution/overview/?video=play> *(tm)*