如果列表仅包含单个元素,我如何更改 SELECT 元素的样式?
我有:
<select class="attribute_select">
<option selected="selected">001</option>
<option>002</option>
</select>
我需要:
<select class="attribute_select_single">
<option selected="selected">001</option>
</select>
更新
<select name="{$groupName}" id="group_{$id_attribute_group|intval}" class="attribute_select" onchange="findCombination();getProductAttribute();">
{foreach from=$group.attributes key=id_attribute item=group_attribute}
<option value="{$id_attribute|intval}"{if (isset($smarty.get.$groupName) && $smarty.get.$groupName|intval == $id_attribute) || $group.default == $id_attribute} selected="selected"{/if} title="{$group_attribute|escape:'htmlall':'UTF-8'}">
{$group_attribute|escape:'htmlall':'UTF-8'}</option>
{/foreach}
</select>