Thursday, July 8, 2010

jQuery, class Selector

You create a Html Tag and with jQuery you can manipulate it.

Syntax:
$(".className").css(propertyName', 'propertyValue');

See the example below.









<html>
<head>
<style type='text/css'>


</style>

<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'></script>
<script type='text/javascript'>
$(document).ready(function(){
$('.fer').css('width','220px').css('height','110px')
.css('border','outset 6px red').css('background','green')

})
</script>
</head>

<body>

<div class='fer'>This is a div tag with a class</div><br>
<span>This is a span tag not affected by jQuery</span>
<p>This is a p tag not affected by jQuery</p>
</body>
</html>








This is a div tag with a class


This is a span tag not affected by jQuery

This is a p tag not affected by jQuery


No comments:

Post a Comment