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 <
[email protected]> 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: [email protected]
> o: 303.746.7302
> Advancing the way the world uses the
> cloud<http://solidfire.com/solution/overview/?video=play>
> *™*
>
--
*Mike Tutkowski*
*Senior CloudStack Developer, SolidFire Inc.*
e: [email protected]
o: 303.746.7302
Advancing the way the world uses the
cloud<http://solidfire.com/solution/overview/?video=play>
*™*