Below is my code and i am trying to get value of the above text box when click on the <a> which is in same div. I mean to say if i click on second "add to cart" link than it will give me "test2" as per my screenshot.
<html>
<head>
<script src="jquery-1.3.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$( document ).ready(function() {
$(".ProductActionAdd a").click(function(){
alert($('.ProductActionAdd a').prevAll(".ProductActionAdd a:first").attr('value'));
})
});
</script>
</head>
<body>
<div class="ProductActionAdd">
<input type="text" value=""/>
<a class="button" href="#">Add To Cart</a>
</div>
<div class="ProductActionAdd">
<input type="text" value=""/>
<a class="button" href="#">Add To Cart</a>
</div>
<div class="ProductActionAdd">
<input type="text" value=""/>
<a class="button" href="#">Add To Cart</a>
</div>
</body>
</html>
but not getting success.

Please suggest me solution.