Monday, February 25, 2013

jQuey .toggleClass() Example in ASp.Net

In previous posts, I explained jQuery Draggable Div Example in ASP.Net, jQuery Resizable Div Example in ASP.Net, Drag and drop HTML list item with in list using jQuery, jQuery Magnifier Example. Here, I will show you a simple example of  .toggleClass() using jQuery in ASP.Net.

jQuery .toggleClass()

.toggleClass() uses for add or remove one or more classes from each element in the set of matched element.
In simple, using .toggleClass() you can add or remove the CSS class from element.

To implement this we need to write the code like as shown below

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ResizabeDiv._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
<head runat="server">
    <title>jqury toggleClass Example</title>
 <script src="" type="text/javascript"></script>
<script src="" type="text/javascript"></script>
<link rel="stylesheet" href="" type="text/css" media="all" />
    <style type="text/css">
            background-color: red;              
     <script type="text/javascript">
         $(document).ready(function () {
             $("#btnToggle").click(function () {
                 return false;

    <form id="form1" runat="server">
    <div id="demodiv" class="demodiv">       
    <asp:Button ID="btnToggle" runat="server" Text="Click me!!" />


No comments:

Post a Comment

If You Enjoyed This Post Please Take 5 Seconds To Share It.

^ Scroll to Top hgpromo