I have a textbox where the user can enter in a note. But this textbox will only display if a checkbox is ticked, otherwise it is hidden. But when the save button is clicked and it saves the values to the database, the textbox is returning a blank value.

Code for textbox:

<textarea class="mceEditorWide" id="txtAddDetailNote" rows="30" cols="50" style="width:100%;display:none" runat="server"></textarea>

Checkbox that hides/shows textbox:

 $('#<%= chkNotes.ClientID %>').change(function () {
        if($(this).is(":checked")) {
             $('#<%= txtAddDetailNote.ClientID %>').show(); 
            } 
        else { 
               $('#<%= txtAddDetailNote.ClientID %>').hide(); 

            }
    });

When I remove the display:none from the textbox, it saves the value. But with display:none in the code, it only returns a blank value, even though the textbox is displaying when I click the save button.

Related posts

Recent Viewed