【问题标题】:Add ID or CLASS to select.option in JHTML select lists将 ID 或 CLASS 添加到 HTML 选择列表中的 select.option
【发布时间】:2013-09-16 11:53:48
【问题描述】:

我有这段代码,我正在尝试向这 2 个 select.option 中的每一个添加一个 id="" 或 class="" .... 有人可以帮帮我吗,我尝试了不同的方式和位置但它只是不起作用......

$status []=JHTML::_('select.option','1',JText::_('Yes'),'id','title');
$status []=JHTML::_('select.option','0',JText::_('No'),'id','title');

在现场这段代码看起来像

<label for="show_map1">Yes</label>
<label for="show_map0">No</label>

我想要实现的是:

<label for="show_map1" id="map_yes">Yes</label>
<label for="show_map0" id="map_no">No</label>

有人可以帮帮我吗?

谢谢

【问题讨论】:

  • 您如何创建列表本身? select.booleanList 默认会生成带有 id 的标签。

标签: html joomla joomla2.5 joomla1.5


【解决方案1】:

试试这个,

$manufacturers = array ('Nike','Adi');
$lists['manufacturers'] = JHTML::_('select.genericlist', $manufacturers, 'virtuemart_manufacturer_id', 'class="inputbox"', 'value', 'text', $product->virtuemart_manufacturer_id );



//$manufacturers is the options array
//virtuemart_manufacturer_id is the id and name of the filed
//'class="inputbox"' you can add additional class here
//$product->virtuemart_manufacturer_id is used for set default selection like Nike or Adi here.

echo $lists['manufacturers'];

希望它的帮助..

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-02-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多