Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery, set value of td in a table?

Tags:

jquery

I create dynamic a table with <tr> and <td> tags. One of the td tags gets the id "detailInfo". I have an onclick function on some button. I would like to set some value in the td "detailInfo" after pressing on the button.

So how can I set the value of the td with id "detailInfo" ?

This is the td:

<td id="detailInfo" rowspan="2" width="300px">picture detail</td> 
like image 869
Ola Avatar asked Apr 11 '14 13:04

Ola


1 Answers

use .html() along with selector to get/set HTML:

 $('#detailInfo').html('changed value'); 
like image 64
Milind Anantwar Avatar answered Sep 21 '22 13:09

Milind Anantwar