JQuery ready event

JQuery ready event will fire when the page is load completed at client side. Generally we will use ready event to bind events, apply styles or other manipulations.

Applying styles to div in ready event

Style applied to this div using JQuery in ready event.
In this example we applied Background color, fore color, height, width using JQuery.

<script language="javascript"> $(document).ready(function () { $("#divContent").css("background-Color", "green"); $("#divContent").css("height", 120).css("width", 250).css("padding", 10).css("color", "white"); $("#divContent").css("text-align", "justify"); $("#divContent").css("border-radius", 15).css("-moz-border-radius", 15); }); </script>

Adding events to button in ready event

We can apply different styles using JQuery, In this example we applied animation to button using jquery, when you click this button it's height & width will be increases automatically and reset to its normal positon by using jquery animation.