0

Here are my controls:

<div class="row">
    <asp:LinkButton ID="btnDescrizione" runat="server" CssClass="btn waves-effect waves-red btn-large">Aggiungi Descrizione</asp:LinkButton>
</div>

<div class="input-field col s6">
    <asp:TextBox ID="txtDescrizione" TextMode="multiline" Columns="50" Rows="5" CssClass="materialize-textarea" runat="server" />
    <label id="lblDescrizione" for="txtDescrizione" runat="server">Textarea</label>
</div>

Here is my JavaScript

<script type="text/javascript">
    $(document).ready(function() {
    $('#<%= btnDescrizione.ClientID %>').change(function() {
    $('#<%= txtDescrizione.ClientID %>').is(':clicked') ? $('#<%= txtDescrizione.ClientID %>').show() : $('#<%= txtDescrizione.ClientID %>').hide();
  });
});
</script>

I know how to do it in code behind, but I would like to make it work with JavaScript because in that way my page won't refresh.

1 Answer 1

1

I think you are looking for the onclientclick property.

https://learn.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.button.onclientclick?view=netframework-4.8

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.