How to put placeholder on jquery ui combobox?

I am watching jquery ui combobox but I could not find it. Where can I find a place in the source code.

Thank you

+5
source share
6 answers

add id to your input and run this code in javascript

$("#yourID").attr("placeholder", "Your Text Here");
+4
source

I made this code for jQueryUI v1.10.2 - 2013-04-17

HTML code:

<select class="combobox" placeholder="123">
 <option>...</option>
 ...
</select>

JS Code:

$.widget( "ui.combobox", {
    _create: function() {
        this.wrapper = $( "<span>" )
            .addClass( "ui-combobox" )
            .insertAfter( this.element );

        this._createAutocomplete();
        this._createShowAllButton();
        this.input.attr("placeholder", this.element.attr('placeholder'));
    },
});

$(function() {
    $( ".combobox" ).combobox();
});
+12
source

jquery ui 1.10.3: var input = $("<input>") combobox -:

.attr("placeholder", select.attr("title"))

title select:)

+1

:

<input type="text" placeholder="your text"/>
0

input.
html5 placeholder .

<input type="text" placeholder="Search...">

, placeholder Internet Explorer.
.

demo : using placeholder
demo : crossbrowser workaround

0
source
<select id="test" name="test">
  <option value=""></option> <!-- clear default value-->
  <option value="1">text 1</option>
  <option value="2">text 2</option>
</select>

<script>
 $('#test').combobox();
 $('.ui-autocomplete-input').css('width','300px')
 $('.ui-autocomplete-input').attr('placeholder','Select a value')
</script>
0
source

All Articles