Tuesday, 27 September 2011

Add option in dropdown list Through JQuery


<html>
<head>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>

<script type="text/javascript">
      function AddOption()
      {                      
          $("#ddlTech").append($('<option></option>').val("Ora").html("Oracle"));
      }
</script>
</head>

<body>
<form>
      <select id="ddlTech">
        <option>Dot Net</option>
        <option>PHP</option>
        <option>Flex</option>
      </select>
           
      <input type="button" onclick="AddOption()" value="Add option">
</form>
</body>

</html>

No comments:

Post a Comment