Thứ Ba, 6 tháng 4, 2010

Add a css Class Using Jquery




To use Css Class in an HTML Tag we can use a Jquery function addClass(). This function add a css class into your HTML tag.The most intresting things is that you can use this class on a eventhandler also, To get effects when a client/user response on it.

This is an example to add a css class into a Html Tag


<script type="text/javascript">

$(document).ready(function(){

$('.click').click(function(){

$('p').addClass('green');

});

});

</script>

<style type="text/css">

.green{ color:green;}

</style>


Write this code into your body tag

<button class="click">Click Me</button>


Không có nhận xét nào:

Đăng nhận xét