【发布时间】:2019-09-23 16:20:30
【问题描述】:
如果输入被选中,我需要仅显示一个 div。 所以我这样做了:
$(document).ready(function () {
$('#group_1 input').each(function () {
if ($(this).val() == ('23') && $(this).is(':checked')) {
$('#showtext').show();
} else {
$('#showtext').hide();
}
});
});
被调用的组在这里(PrestaShop 1.7.5.1):
{elseif $group.group_type == 'radio'}
<ul id="group_{$id_attribute_group}">
{foreach from=$group.attributes key=id_attribute item=group_attribute}
<li class="input-container float-xs-left">
<label class="accordion--form__label">
<input class="input-radio" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}>
<span class="radio-label">{$group_attribute.name}</span>
</label>
</li>
{/foreach}
</ul>
{/if}
但是,如果选中 #group_1 值 24 或未选中任何内容,我需要 > 隐藏 #showtext。 我不能拥有这个。怎么了?
我要隐藏/显示的值 23 的源代码是:
<input class="input-radio" type="radio" data-product-attribute="1" name="group[1]" value="23" checked="checked">
当它处于活动状态时,必须隐藏 div:
<input class="input-radio" type="radio" data-product-attribute="1" name="group[1]" value="24">
【问题讨论】:
-
我仍然找不到解决此问题的方法。有人可以吗?
标签: input show-hide prestashop-1.7