Clear INPUT TextBox and DropDownList (HTML SELECT) Items using jQuery on Button Click

Last Reply on May 08, 2014 04:48 AM By Azim

Posted on May 08, 2014 03:43 AM

Hello team,

I am tryed to use Jquery for clear text box value and set detafult value to drop down list using c#. Asp button control.

My code as per follows


 <script src="../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#btnClear").click(function () {


<input type="button" id="btnClear" value="Clear" class="save" onclick="return ClearField();" />

By clicking Clear button alert msg show, but i m not able to clear text box. Please help. Thanks.

Posted on May 08, 2014 04:48 AM

This way

<html xmlns="">
<head runat="server">
    <script src=""></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("[id*=btnClear]").click(function () {
    <form id="form1" runat="server">
        <input type="text" id="txtCityAbbv" name="name" value="Hello" />
        <select id="sFruits">
            <option value="1">Mango</option>
            <option value="2">Banana</option>
            <option value="3">Apple</option>
        <hr />
        <input type="button" id="btnClear" name="name" value="Clear" />