connectseekers.com

Wednesday, 28 May 2014

Reset Div Height by Using jQuery

5/28/2014 - By Pranav Singh 0

Today’s time jQuery have become one of the most popular javascript library amongst the web developer. Here in this article I will explain you how you can manage the reset the height of a div control by using jquery.  This article example you can use n your asp.net and mvc application.

In this I have used height .hight() to reset the height of the div control when user click on the div control.


So for this article first create a new asp.net application and add the below code.

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Reset Div Height by Using jQuery</title>
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <style>
        body
        {
            font-size: 12px;
            font-family: Arial;
        }
        .divclass
        {
            font-size: 12px;
            font-family: Arial;
            width: 70px;
            height: 80px;
            float: left;
            margin: 6px;
            background: green;
            cursor: pointer;
        }
    </style>
    <script>
        $(document).ready(function () {
            $(".divclass").click(function () {
                $(this).height(20)
             .css({ cursor: "auto", backgroundColor: "red" });
            });
        });</script>
</head>
</head>
<body>
    <form id="form1" runat="server">
    <div class="divclass">
    </div>
    <div class="divclass">
    </div>
    <div class="divclass">
    </div>
    <div class="divclass">
    </div>
    </form>
</body>
</html>

Please check the below code which is responsible for performing the operation

    <script>
        $(document).ready(function () {
            $(".divclass").click(function () {
                $(this).height(20)
             .css({ cursor: "auto", backgroundColor: "red" });
            });
        });</script>

Now run the application for final output.





 DOWNLOAD




About the Author

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Get Updates

Subscribe to our e-mail newsletter to receive updates.

Share This Post

0 comments:

Please let me know your view

Free Ebooks


About Us

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Contact Us

For writing article in this website please send request by your

GMAIL ID: dotnetpools@gmail.com
Email Id : contact@aspdotnet-pools.com

Bugs and Suggestions

As we all know that this website is for sharing knowledge and providing proper solution. So while reading the article is you find any bug or if you have any suggestion please mail us at contact@aspdotnet-pools.com.

Partners


Top jQuery Plugins

Global Classified : Connectseekers.com
© 2014
back to top