title: call javascript function on asp dropdown list change
body: <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>        &lt;script type="text/javascript"&gt;
              function ddl(id) {
        //          var id = document.getElementById('&lt;%=DDLquestionType.ClientID%&gt;').value;
                  if (id == "Open") {
                      AmericanAnswer.style.display = 'none';
                      document.getElementById('Answer1_Btn').style.visibility = false;
                      
                  }
                  alert(id);
              }
          &lt;/script&gt;</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>                &lt;asp:DropDownList ID="DDLquestionType" CssClass="ddlQuestionType box"  runat="server" AutoPostBack="True" onchange="ddl(this)" &gt;
                      &lt;asp:ListItem Text="American" Value="American"&gt;&lt;/asp:ListItem&gt;
                      &lt;asp:ListItem Text="Open" Value="Open"&gt;&lt;/asp:ListItem&gt;
                      &lt;asp:ListItem Text="Yes/No" Value="YesNo"&gt;&lt;/asp:ListItem&gt;
                      &lt;asp:ListItem Text="Numerical" Value="Numerical"&gt;&lt;/asp:ListItem&gt;
                  &lt;/asp:DropDownList&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I have this java script function:</p>
  
  <p>Which I try to call on drop down list selection change</p>
  
  <p>It doesn't work. 
  I also tried
      onchange="javascript:ddl()" and function without parameters, 
      ononchange="javascript:ddl(this);", 
      ononchange="javascript:ddl(this.value);", 
  and many others.
  I'm new to java script, any links with explanations also will be highly appreciated</p>