ghadad
(Golanh)
1
Events in htmlOptions in Chtml::link method is converted to html entites .
for example :
echo CHtml::link("Rate this","#",$htmlOptions = array('onclick'=>'$("#writerating").focus()'));
generates :
[html]<a onclick="$("#writerating").focus()" href="#">Rate this</a>[/html]
any idea how can i solve it ?
Thanks
Golan
dito_ch
(R Fuerst)
2
Hi ghadad
You should probably separate your html tags and your jQuery code:
echo CHtml::link("Rate this","#",array('id'=>'target'));
and then somewhere in your view:
Yii::app()->clientScript->registerScript(
'someName',
'$("#target").click(function() {
$("#writerating").focus();
});'
);
ghadad
(Golanh)
3
Thank you dito .
I’ll use that . sometimes you want to write the code “on the fly” .