sam sam - 3 months ago 7
HTML Question

Add href to txthtml column


  • I am binding the values from Sql DB to dynamic html table.And it
    contains one constant columun(Action) which should contain adress of
    particular portal for all rows of the html table.

  • With below code I am finding no luck to assign href to
    <td>



Can any one help me how can I solove this

txtHTML = txtHTML + "<td>";
txtHTML = txtHTML + <a href="http://www.w3schools.com">Action</a>+ "</a>";
txtHTML = txtHTML + "</td>";

Answer

It is just the matter of the usage of " and ' in your code as a string

txtHTML = txtHTML + "<td>";
txtHTML = txtHTML + "<a href='http://www.w3schools.com'>Action</a>";
txtHTML = txtHTML + "</td>";

This above code will help you!