<asp:Button ID="btnExpand" runat="server" CssClass="btn" Text="Expand" ToolTip="Expand text area to view all text"
Enabled="true" OnClientClick="return false;"/>
<asp:Button ID="btnShrink" runat="server" CssClass="btn" Text="Shrink" ToolTip="Shrink text area to original size"
Enabled="false" />
<script type="text/javascript">
document.getElementById('<%= this.btnExpand.ClientID %>').addEventListener("click", function () {
if (document.getElementById('<%= this.txtTextArea.ClientID %>').clientHeight < document.getElementById('<%= this.txtTextArea.ClientID %>').scrollHeight) {
document.getElementById('<%= this.txtTextArea.ClientID %>').style.height = document.getElementById('<%= this.txtTextArea.ClientID %>').scrollHeight+ "px";
document.getElementById('<%= this.btnShrink.ClientID %>').disabled = false;
document.getElementById('<%= this.btnExpand.ClientID %>').disabled = true;
}
return false;
});
document.getElementById('<%= this.btnShrink.ClientID %>').addEventListener("click", function () {
document.getElementById('<%= this.txtTextArea.ClientID %>').style.height = '80px';
document.getElementById('<%= this.btnShrink.ClientID %>').disabled = true;
document.getElementById('<%= this.btnExpand.ClientID %>').disabled = false;
return false;
});
page is reloading when shrinking in IE, but works fine in Chrome