08-06-2023, 04:06 PM
How can I add additional attributes to my select menu option tags? Like this:
<select class="test" name="data[Test][test]">
<option value="1" data-price="100">My Option</option>
</select>
How do I add the `data-price="100"` ?
I tried something like this but it didn't work:
<?php
echo $this->Form->select('test', $options, null, array(
'class' => 'test',
'options' => array(
'data-price' => 100
)
));
?>
<select class="test" name="data[Test][test]">
<option value="1" data-price="100">My Option</option>
</select>
How do I add the `data-price="100"` ?
I tried something like this but it didn't work:
<?php
echo $this->Form->select('test', $options, null, array(
'class' => 'test',
'options' => array(
'data-price' => 100
)
));
?>