is there any way to prevent htmlencode the attributes

I’m writing a widget, there’s a function like this:


    

public static function getHtmlItem($item, $index){

        return Html::tag('li',$item->title,['onmouseover'=>"$(this).addClass('cur');",'onmouseout'=>"$(this).removeClass('cur');"]);

    }



in the client ,it shows like this:

7048

QQ截图20160731180628.png

is there any way to prevent it HTML-encodes the attributes when i use the method Html::tag()??

Hi

Try this…





public static function getHtmlItem($item, $index){

        return Html::tag('li',$item->title,['onmouseover'=>"$(this).addClass(\"cur\");",'onmouseout'=>"$(this).removeClass(\"cur\");"]);

    }