Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="/path/to/jquery.plug-in.js"></script>

<div>
    <select id="sb1" class="ddl">
        <option title="1"> 1</option>
        <option title="2"> 2</option>
        <option title="3"> 3</option>
    </select>

    <input id="myText" class="text" />
</div>

<script type="text/javascript">
    $(document).ready(function () {
            $("#<%= ddlName.ClientID %>").change(function () {
                 $("#<%= tbName.ClientID %>") = this.value;
            });

            $("#<%= ddlState.ClientID %>").change(function () {
                 $("#<%=tbState.ClientID %>") = this.value;
            });
        });
 </script>
Posted
Comments
SteveyJDay 1-Aug-14 16:46pm    
You can't put ASP markup <%= ddlName.ClientID %> in javascript code. That is your first problem. Second the Ids in the javascript code don't match the Ids in the ASP markup.

1 solution

Hi,

use
JavaScript
$("#sb1").change(function () {
                $("#myText").val($("#Sb1 Option:Selected").text()) = this.value;
           });
 
Share this answer
 
v2
Comments
Nirav Prabtani 2-Aug-14 5:24am    
my 5+

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900