Search code examples
jqueryoracle-jet

Highlight combobox text on click in Oracle jet


I want to highlight the text when click on combobox. This is JQuery example http://jsfiddle.net/Ilmv/5zWad/

I would like to do the same on my combobox, but it is not working. Oracle jet expands their components at run time to add their own classes. So, I am confused on which id or class I need to apply.

This is my editable combobox.

 <input id="combobox" class="seriescombobox" list="series"
     data-bind="ojComponent:{component:'ojCombobox',value:seriesValue,
               optionChange:LoadSerieses(), 
               rootAttributes: {style:'min-width:32em'}}"/>
     <datalist id="series">
           <!-- ko foreach: serieses -->
               <option data-bind ="value:value,text:label">
               </option>
           <!-- /ko -->
     </datalist>

This is the JQuery code I am using to highlight the text.

      $(".oj-combobox-input").focus();
      $(".oj-combobox-input").select();

I tried with all possible ids and classes but no luck. Please help. Thanks.


Solution

  • This worked finally.

    This will make text to highlight when click on the combobox.

    $(".oj-combobox-input").attr('onclick','this.select()');
    

    Once you mouse up focus will gone. Below line is to keep the text highlight.

    $(".oj-combobox-input").attr('onmouseup','return false');