Another Solution : Here another Solution That overlaying the td with absolute layer of div which takes its height dynamically from data-rowspan attribute
$("div.row-span").each(function(){
var rowSpan = $(this).data("rowspan")
//$(this).parents("td").attr("rowspan",rowSpan)
var divHeight = $(this).parents("td").innerHeight()*rowSpan;
$(this).height(divHeight)
})
Is it possible to place a <div> inside a <td> which <span> several rows without setting <td>‘s rowspan atTribute? I know <div> does not have a rowspan attribute.
There will be too much manipulation within the table. I will add, move, delete so many DIVs and it will bring too much manipulation over table. I am thinking of a safer and a shorter approach. Doing, undoing each and every table cells with so many actions will increase complexity.
Comment posted by Temani Afif
you want the div to overlap the 3 next TD?
Comment posted by gridbyexample.com/examples
CSS grid instead of a table may be an option:
Comment posted by user3021830
Yes, but in a vertical manner.
Comment posted by user3021830
That looks exactly what I need. Thank you very much.
Comment posted by user3021830
You are still manipulating
but over
this time. Not I have expected but makes quite sense. I will try this approach. Thank you.
Comment posted by Temani Afif
@user3021830 I don’t see why doing such thing. Adding an attribute to one element to later put it (using jQuery!) inside another element. It doesn’t make a lot of sense. Simply add the attribute on the td and you will have the same result with a more logical code
Comment posted by Ahmed El-sayed
@TemaniAfif , i think he needs to overlaying the current