Need help converting to code jQuery
===

I have a textbox inside the EditItemTemplate of a gridview (edititemtemplate), and i need to set the height of the textbox automatically everytime to fit all the contents whenever i click the edit button.

I understand that it would be difficult to retrieve the control ID of the textboxes since the ID will be changed everytime the edit event is fired, and it will be better to put it into a class or something.

I have this set of code (which is used for another textbox OUTSIDE the gridview, and it works) which i put on the Javascript pageLoad event so that it will automatically size the height itself according to the amount of texts everytime the page loads.

 

    function pageLoad() {
                 document.getElementById("<%=tb1.ClientID%>").style.height = document.getElementById("<%=tb1.ClientID%>").scrollHeight + "px";
             };

I do not want to fix set the height of the textbox.

So how do i convert the above line of codes into a jquery class so that i can use it?? Or rather, how can I retrieve the scrollHeight so that I can set it in the class?? Or can anybody recommend me a better method to get what i want to achieve? Pardon me for my poor knowledge in jQuery and my poor explanation.

Please help, I've been stucked at this part for days, 