I’m new for jquery….. i have a doubt in the code given below….. if i click the btn the corresponing parent div only should move. Check the code give below. Thanks in advance.
<script type="text/javascript">
$(document).ready(function(e) {
$('.btn').click(function(){
$('.aaa').animate({'left':'500'},500);
return false;
});
});
</script>
</head>
<body>
<div class="cnt">
<div class="aaa" style="width:50px; height:50px; background-color:red; position:relative"></div>
<a href="#" class="btn">Btn</a>
</div>
<div class="cnt">
<div class="aaa" style="width:50px; height:50px; background-color:red; position:relative"></div>
<a href="#" class="btn">Btn</a></div>
Try like this: