Friday, November 12, 2010

Reset the text box text in masterpage and jquery

  1. <script>   
  2.     $(document).ready(function() {  
  3.       $('[id$=lnkBtn]').click(function() {  
  4.         $('[id$=TextBox1]').val("");  
  5.         return false;  
  6.       });  
  7.     });     
  8. </script>  
Another example of reset textbox is

<asp:Content ID="cntHeader" ContentPlaceHolderID="head" runat="Server">
<script type="text/javascript" src="../Scripts/jquery.js"></script>

<script type="text/javascript">

    $(document).ready(function () {
        $('[id$=lnkCancel]').click(function () {
            $('[id$=txtFirstName]').val('');
            $('[id$=txtLastname]').val('');
            $('[id$=txtEmail]').val('');
            $('[id$=txtPhone]').val('');
        });

    });

Reset the dropdownlist
$('select[id$=\'DropdownlistID\']').val(-1);



    No comments:

    Post a Comment