Accessing gridview cell using Jquery

I am accessing gridview cell using jquery and populate it in the textbox.
But for the first row, I am getting the value enclosed in a div element

Here is my code

 $(document).ready(function () {

            $("#<%=gvEmployee.ClientID%> tr:has(td)").click(function () {
                var cell = $(this).find("td:eq(1)");
                var name = $(this).find("td:eq(2)");

                $get("<%=txtEmpNo.ClientID %>").innerText = cell.html();
                $get("<%=txtReportingTo1.ClientID %>").innerText = name.html();
                $get("<%=hdnPersonal.ClientID %>").value = "true";

All other rows are working except the first row.
The value is <div style="width: 112px;" class="GridCellDiv">Name1</div>

All other rows , Name is coming correctly
Who is Participating?
Rainer JeschorConnect With a Mentor Commented:
why are you using the
  $get("<%=txtEmpNo.ClientID %>").innerText = cell.html();

Open in new window

If you do not need the HTML markup, you might try to use
  $get("<%=txtEmpNo.ClientID %>").innerText = cell.text();

Open in new window


Otherwise please post the code where you generate your gridview.
Thanks and HTH
niyasfairoseAuthor Commented:
Hi Rainer..
Hats off...
You simply solved that ..

It is working now..
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.