jQWidgets Forums

jQuery UI Widgets Forums Lists ComboBox Setting disply text of combo box

This topic contains 2 replies, has 2 voices, and was last updated by  SS 13 years ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Setting disply text of combo box #4343

    SS
    Member

    hi,
    how to set display text of combo box pragmatically.
    or
    how to set selected index of combo box based on text or value.

    Setting disply text of combo box #4360

    Peter Stoev
    Keymaster

    Hi sushrut.sawarkar,

    To set the selected index based on a value, you can use this:

    // get all items.
    var items = $("#jqxWidget").jqxComboBox('getItems');
    // find the index by searching for an item with specific value.
    var indexToSelect = -1;
    $.each(items, function (index) {
    if (this.value == "Blido Comidas preparadas") {
    indexToSelect = index;
    return false;
    }
    });
    $("#jqxWidget").jqxComboBox({ selectedIndex: indexToSelect });

    To set the ComboBox’s Text to a custom value, you can do this:

    $("#jqxWidget").find('input').val("My Value");

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Setting disply text of combo box #4361

    SS
    Member

    Thanks a lot Peter 🙂

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.