I am using t:selectItem
inside a s:selectOneMenu
. My itemLabel are too long to be seen inside the selectOneMenu
window. Does anyone know, how to get a tooltip for each selectItem? Appreciate any ideas in this direction.
Asked
Active
Viewed 1,113 times
3
-
check this link http://stackoverflow.com/questions/8634563/tooltip-for-each-selectonemenu-items-in-jsf – NPKR Jan 07 '13 at 05:44
-
sorry pradeep it won't work... – ANIL Jan 07 '13 at 06:00
-
could you please show the code of your `selectOneMenu`? – prageeth Jan 07 '13 at 09:57
1 Answers
1
You can use javascript
for this. Since you haven't provided any code sample I use following sample. You may catch the concept and apply it for your requirement accordingly.
<h:form id="myForm">
<h:selectOneMenu id="myCombo">
<f:selectItem itemLabel="Label1"/>
<f:selectItem itemLabel="Label2"/>
<f:selectItem itemLabel="Label3"/>
</h:selectOneMenu>
</h:form>
your javascript
code should be as below.
<script>
window.onload = function(){
var options = document.getElementById("myForm:myCombo").options;
for(var i = 0; i < options.length; i++) {
options[i].title = options[i].innerHTML;
}
}
</script>

prageeth
- 7,159
- 7
- 44
- 72
-
Thanks for your help man..but it also not working...any other suggestion please??? – ANIL Jan 07 '13 at 09:51
-