Here is the method through which you can access Asp.net control's Id using javascript.
When you are working on a simple form.
Let's suppose you want to make a textbox clear or blank on a button click on client-side
HTML
- <asp:TextBox ID="txtPassword" runat="server" TextMode="Password"></asp:TextBox>
- <script type="text/javascript">
- function clrCtrl() {
- document.getElementById('txtPassword').value = "";
- }
- </script>
- <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
- <script type="text/javascript">
- function clrCtrl() {
- document.getElementById('<%=txtPassword.ClientID%>').value = "";
- }
- </script>
- // here you html code begins
- </asp:Content>

Join the conversation! Your thoughts help the community grow.