<div id="post">
<form name="postComment" id="commentPost6" action="javascript:void(0);" method="post"
target="_top" onsubmit="return commentPost(6)">
<textarea name="comment" id="comment6" class="commentText"
cols="10" rows="3" accesskey="1">
</textarea><br>
<input type="submit" name="submit" id="commentpost" value="Submit" accesskey="2">
</form>
</div>
this is my post div tag, i have multiple div tag with same id="post", the form and fields are dynamically generated and id of both form and textarea are unique, so that there is no problem in retriving those values, on click of submit, i call commentPost method.
function commentPost(postId)
{
alert("Inside commentpost");
//how to retrive/access value of textarea here
}
how to get value of textarea ?? and just in case
Yes, i know it's not valid HTML to have multiple elements with the same ID.
$('#comment'+postId).val();
Why aren't you simply using classes instead of ids? (post)