Mayukh Raaj Mayukh Raaj - 9 months ago 52
Javascript Question

How to include rowspan and colspan dynamically inside <td> tag based on some conditions

I know i can include statically when i want to merge the columns but if i need to check some conditions and based on that only i need to merge then how this could be done?

my idea was like this:

var span="";
if(some condition)

and then setting this variable inside as:

<td +span+>

but it doesn't work like that…Any suggestion how to do this?

Answer Source
var span='';
var table='';

if(some condition)

var table="<tr><td"+span+"></td></tr>":