You must Sign In to post a response.
  • Category: JQuery

    To select a value in the dropdown based on value entered in text box

    I have a text box and a dropdown. once i enter a value in the textbox,i need to select that value the dropdown that contains that particular and it shoud select the first value in the dropdown that matches the text.

    Suppose i have dropdown with values
    itemone
    itemtwo
    itemthree

    and i entered item in the textbox.
    it should select "itemone" in the dropdown.
    Can someone help please?
  • #761386
    can someone help please

  • #761389
    I agree with the post.

    ???????????? ????????????????? ?????????????????? https://www.royal-1688.net

  • #761391
    you can use the following logic in javascript.

    var DropDownCtrl = document.getElementById("DDControl");

    for loop..
    if(TxtBoxValue = e.options[i].value)
    e.options[i].selected = "selected"

    By Nathan
    Direction is important than speed

  • #761433
    Hello,

    Refer the below code :

    function SetValue() {

    var textval = document.getElementById('<%=textbox1.ClientID%>');
    var ddlPaymentStatus = document.getElementById("<%=ddlPaymentStatus.ClientID %>");


    if (textval.value != "" && textval.value != null) {
    // If data is there select "Paid" from DropDownList.
    selectItemByValue(ddlPaymentStatus, 1);
    }
    else {
    // If data is not there, then select "--Select--" from DropDownList.
    selectItemByValue(ddlPaymentStatus, 4);
    }
    }

    You can refer the below link :

    http://www.codegateway.com/2013/04/set-dropdown-text-selected-from-textbox.html


    Hope this will help you.

    Regards,
    Nirav Lalan
    DNS Gold Member
    "If you can dream it, you can do it."


  • Sign In to post your comments