Difference between #1 and #2 of
htmlOptions explained for various controls.

Changes

Title unchanged

htmlOptions explained for various controls.

Category unchanged

Tips

Yii version unchanged

Tags unchanged

htmlOptions, chtml

Content changed

[...]
<option>
<option>
</select>
~~~

To get attributes onto the options, add a sub-array called "options" to your
$htmlOptions. For example to color each item in your drop down a different color this code:


```php
$items = array("1" => "first", "2" => "second");
$options["options"] = array("1"=>array("style" => "color:red"), "2"=>array("style"=>"color:blue"));
[...]
15 0
14 followers
Viewed: 66 445 times
Version: 1.1
Category: Tips
Written by: Woil
Last updated by: Woil
Created on: Feb 11, 2011
Last updated: 13 years ago
Update Article

Revisions

View all history