Add Attributes To The Options In Drop Down List

Hi,

I need to add "onmouseover" for each options in drop down list like the sample html code given below.




<!DOCTYPE html>

<html>

<head>

<script>

function preferedBrowser()

{

prefer=document.forms[0].browsers.value;

alert("You prefer browsing internet with " + prefer);

}

</script>

</head>


<body>


<form>

Choose which browser you prefer:

<select id="browsers">

<option value="Chrome" onmouseover="preferedBrowser()">Chrome</option>

<option value="Internet Explorer" onmouseover="preferedBrowser()">Internet Explorer</option>

<option value="Firefox" onmouseover="preferedBrowser()">Firefox</option>

</select>

</form>


</body>

</html>



How do I add onmouseover like above? My code in yii given blow




$list = CHtml::listData(Address::model()->findAll('company_id=:company_id', array(':company_id'=>Yii::app()->session['compnay_id']), array('order' => 'company')), 'address_id', 'company');


<?php

echo CHtml::dropDownList('address', $address, $list, array('class'=>'input_lg utities-trigger'));

?>



It would be much appropriated if any one can help on this.

Hi,

Following below way it can help you lot

One way:

// htmloptions

array(

‘id’ => ‘hide’,

‘onmouseover’=>‘functionName()’

)

Another way:

<script type="text/javascript">

$("#hide").mouserover(function(){

//your code

});

</script>