Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何检查禁用的选择元素,我想通过检查它来更改禁用元素的不透明度 $\u product=$this->getProduct(); $\u attributes=Mage::helper('core')->decorarray($this->getAllowAttributes()); ?> * class=“last”> , ); var prochildata=;_Javascript_Jquery_Html_Css_Magento 1.9 - Fatal编程技术网

Javascript 如何检查禁用的选择元素,我想通过检查它来更改禁用元素的不透明度 $\u product=$this->getProduct(); $\u attributes=Mage::helper('core')->decorarray($this->getAllowAttributes()); ?> * class=“last”> , ); var prochildata=;

Javascript 如何检查禁用的选择元素,我想通过检查它来更改禁用元素的不透明度 $\u product=$this->getProduct(); $\u attributes=Mage::helper('core')->decorarray($this->getAllowAttributes()); ?> * class=“last”> , ); var prochildata=;,javascript,jquery,html,css,magento-1.9,Javascript,Jquery,Html,Css,Magento 1.9,这是一个模板的代码,当没有通过外部js选择图像时,在该模板上应用隐藏。 我想检查它,然后想在禁用的元素中添加不透明度,直到选择选项未启用。 提前感谢。请随意给开发者提建议。每个建议对我都很有价值 使用csssyle。你可以这样做 $_product = $this->getProduct(); $_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes()); ?> <

这是一个模板的代码,当没有通过外部js选择图像时,在该模板上应用隐藏。 我想检查它,然后想在禁用的元素中添加不透明度,直到选择选项未启用。
提前感谢。请随意给开发者提建议。每个建议对我都很有价值

使用
css
syle。你可以这样做

$_product    = $this->getProduct();
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
?>
<?php if ($_product->isSaleable() && count($_attributes)):?>
<dl>
<?php foreach($_attributes as $_attribute): ?>
    <dt><label class="required"><em>*</em><?php echo Mage::helper('catalog')->__($_attribute->getLabel()) ?></label></dt>
    <dd <?php if ($_attribute->decoratedIsLast){?> class="last"<?php }?>>
        <div class="input-box">
            <select name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]" id="attribute<?php echo $_attribute->getAttributeId() ?>" class="required-entry super-attribute-select">
                <option><?php echo $this->__('Choose an Option...') ?></option>
              </select>
          </div>
    </dd>
    <?php endforeach; ?>
  </dl>
 <script type="text/javascript">
    var spConfig = new Product.Config(<?php echo $this->getJsonConfig() ?>,   <?php echo $this->getProductsStockStatus()?>);
    var ProChildData = <?php echo $this->getProductsStockStatus()?>;
   </script>
对于slelect元素

select option:disabled{
    opacity: 0;
 }

您可以根据需要将其禁用,然后在提交表单之前删除disabled属性

select:disabled{
    opacity: 0;
}
请注意,如果您依赖于此方法,您还需要以编程方式禁用它,因为如果JS被禁用或不受支持,您将无法使用禁用的select

$('#myForm').submit(function() {
    $('select').removeAttr('disabled');
});

谢谢,但它仍然不起作用。选择被禁用,但没有应用不透明度。基斯甚至可以选择。。。这是一个select标签。谢谢,兄弟,它适合我:-)不需要检查js和jquery内容的简单方法。
$(document).ready(function() {
    $('select').attr('disabled', 'disabled');
});