Using jQuery change Background color of DIV
Change Background Color with jQuery:
If you want to change div text color by Jquery the visit this post. Change Text color
Jquery function :
$(document).ready(function () {
$('div').hover(
function () {
$(this).css({ "background-color":
"red" });
},
function () {
$(this).css({ "background-color":
"blue" });
}
);
});
Jquery to change background color of div on hover:
<%@ Page
Language="C#"
AutoEventWireup="true"
CodeFile="divExample.aspx.cs"
Inherits="divExample"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD
XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>the title</title>
<%--<script
type="text/javascript"
src="https://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.3.2.min.js"></script>--%>
<script type="text/javascript"
src="Scripts/jquery-1.3.2.min.js"></script>
<script type="text/javascript"
language="javascript">
$(document).ready(function () {
$('div').hover(
function () {
$(this).css({ "background-color":
"red" });
},
function () {
$(this).css({ "background-color":
"blue" });
}
);
});
</script>
<style>
.div{ margin:10px;padding:12px;
border:2px solid #666;
width:60px;
}
</style>
</head>
<body>
<table><tr><td align="center"><h1>Change Background Image of DIV using jQuery</h1>
<p>Move mouse on any square below to see the result:</p>
<div class="div" style="background-color:blue;"></div>
<div class="div" style="background-color:blue;"></div>
<div class="div" style="background-color:blue;"></div>
</td></tr></table>
</body>
</html>
jquery mouseover div change background color:
Download JQuery from:
https://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.3.2.min.js&
Learn How to work with Asp.net and C#:
- Cropping image using jQuery in asp.net
- Asp-checkboxlist control demo:
- Asp checkboxlist Example using C#
- Checkboxlist in asp.net(control example)
- Get current datetime in jquery and javaScript.
- jQuery modal dialog with postback in asp.net
- How to use asp ListView control in asp.net:
- how to use Captcha in asp.net Second post
- how to add captcha in Asp.net programming
- Get selected radio button values using JQuery.
- Example jQuery Validate on CheckBoxList using C#
- Displaying the textbox value in javascript Messagebox
- What is the Ajax colorpicker,How to use Ajax colorpicker
- Validate ASP.Net RadioButtonList using JavaScript Example
- Check Uncheck all asp.net CheckBox in asp.net using jQuery
- Example of jQuery Validate on Radiobuttonlist in Asp.Net using C#
- Example of Crystal report(Crystal_report_in asp.net programming )
- How to Make a HTML Table by C# code in asp.net programming
- Example of C# for Bind Data to asp.net Textbox inside gridview control
- Limitation of Characters in Textbox or TextArea in asp.netusing jquery:
Comments
Post a Comment