A while ago I had asked how to make a collapsible comment box like Stackoverflow
The original question is found here
However since then I came across another problem which I am not entirely sure how to go about solving, I am pretty sure that I go about it the same way as the original question but, not quite sure of the syntax.
Basically what my problem is, is that I added a function to limit the # of characters the user enters into the comment and I show the characters remaining.
However because there can be many comment boxes in the list the script is only being executed for the first one in the list, and I need to to be dynamic.
In otherwords just like the links that open the comment box in my original question, each one has a unique id.
How do I do the same for the script that monitors the character input.
$(function(){
$('#comment').keyup(function(){
limitChars('comment', 255, 'charlimitinfo');
})
});
Update: I did get them to be dynamic by doing something like this
$(function(){
$('.comment-<%=ViewData.Model.Entry.EntryID %>').keyup(function(){
limitChars('comment-<%=ViewData.Model.Entry.EntryID %>', 255, 'charlimitinfo');
})
});
However when you open one and then open another the second one takes control...