0

I have a 2 column by 6 row table which is generated by a framework, so I have no control over how the table is originally built.

I want to add a third column on the right that spans all 6 rows by using jQuery. The table has an id, but the rows and cells have no defining features.

This is basically the generated table:

<table id="tbl1">
  <tr>
    <td>...</td>
    <td>...</td>
  </tr>
  <tr>
    <td>...</td>
    <td>...</td>
  </tr>
  ...
</table>

This is what I want it to be like after jquery has done its magic:

<table id="tbl1">
  <tr>
    <td>...</td>
    <td>...</td>
    <td rowspan="6">some new data</td>
  </tr>
  <tr>
    <td>...</td>
    <td>...</td>
  </tr>
  ...
</table>

I'm using jQuery version 1.7.1

2
  • 1
    What is the question? Commented Apr 11, 2013 at 8:56
  • So, What you have tried in JQuery..? Commented Apr 11, 2013 at 8:56

1 Answer 1

2
$('#tbl1 tr').eq(0).append("<td rowspan='6'>some new data</td>");

You can see the jsFiddle of this working here: http://jsfiddle.net/CDUq5/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.