I have a table with variable columns, meaning the columns of the table are dynamic. The number of columns will keep changing, causing the table to be centralized and the margin-left value to adjust accordingly.
Now, I need to calculate the margin-left value of the table as it changes with the number of columns. It's important to note that no margin-left values have been explicitly set for the table.
The reason for calculating the margin-left of the table is to ensure proper alignment with another paragraph. I intend to apply the calculated margin-left value to the paragraph for correct alignment.
Although I attempted to use jQuery to calculate the margin-left value of the table, I was not successful in retrieving the value.
<%= javascript_include_tag "http://code.jquery.com/jquery-1.10.0.min.js" %>
<%= javascript_include_tag "http://code.jquery.com/ui/1.10.3/jquery-ui.min.js" %>
<script>
$(document).ready(function() {
var sp = parseInt($("#table123").css("margin-left"));
var paddT = $('#text123').css("margin-left", sp + 'px' );
});
</script>
By looking at the image, you can see that the text placed above the table is not aligned with the table. This is the issue I am trying to address. As the number of columns changes, the margin left of the table will also change due to its centralization, affecting the table's position. Can someone please assist me with this?