1 Replies - 2535 Views - Last Post: 13 March 2011 - 04:32 AM

How to get unique ID for each textbox when its generating through for

Posted 11 March 2011 - 04:46 AM

This is the code I have. i want unique Id for each text box(id="messageText"). PLEASE GIVE IDEA.
As due to same ID of the text box the JS function is not showing the proper result and the characterleft count is not decreasing automatically.

Re: How to get unique ID for each textbox when its generating through for

but the better solution is to use class instead of id, if you have a function that return all elements with a give class (or if you're using some library) then you process array of textarea-s that have messageText class.

But if the only thing is that you want to count individual count for alls textarea-s then you can add onkeypress event for every area and every event will have variable that point to associated area.