i am trying to use a jquery selector. There are 10 divs in my page. each div has a submit button which has attribute called post and its value varies from 1 to 10. so when first submit button is clicked i want to alert the h1 in the first div. So I tried this
<script>
$(document).ready(function() {
$('.submit').click(function() {
var post = $(this).attr("post");
alert(post);
post = "div#"+post+" h1";
alert(post);
var name = $(post).value();
alert(name);
});
});
but the actual value of post is not being passed even though being a javascript variable.