wwwabcd
(Www Abcd)
1
How can I add different classes to labels in radioButtonList.
I use this code:
echo CHtml::radioButtonList('kk','type',array('1'=>'','2'=>'','3'=>''),array(
'labelOptions'=>array('class'=>'ddd'),
'separator'=>' ',
));
and I get this code:
<input id="kk_0" type="radio" name="kk" value="1">
<label class="ddd" for="kk_0"></label>
<input id="kk_1" type="radio" name="kk" value="2">
<label class="ddd" for="kk_1"></label>
<input id="kk_2" type="radio" name="kk" value="3">
<label class="ddd" for="kk_2"></label>
I want get class="ddd1",class="ddd2",class="ddd3"
oligalma
(Marc Oliveras)
2
you can use nth-child selector:
<!DOCTYPE html>
<html>
<head>
<style>
p:nth-child(3) {
background: #ffff00;
}
p:nth-child(4) {
background: #ff0000;
}
</style>
</head>
<body>
<p>The first paragraph.</p>
<p>The second paragraph.</p>
<p>The third paragraph.</p>
<p>The fourth paragraph.</p>
</body>
</html>
Internet Explorer 8 and earlier versions do not support the :nth-child() selector.
wwwabcd
(Www Abcd)
3
Thank You! but I want know is it possible?
Keith
(Kburton)
4
I don’t think it’s possible with CHtml::radioButtonList(). What do you intend to use the class for?