Hi, I have a div(MedicalBriefsDocumentsTable) with the align attribute set to "centerâ€. I have a span(currentClaimantName) with no align attribute. How can I align the span with the div using JavaScript because the div will expand or shrink based on contents. I want to know where the div position starts and assign that to span using JavaScript. Please make sure that the div and the span are empty when the page loads. The div and the span will fill when user selects a row from another table. My Html is: <table align="center"> <tr> <td> <span id="currentClaimantName"></span> </td> </tr> <tr> <td> <div id="MedicalBriefsDocumentsTable" align="center"></div> </td> </tr> </table> Code (markup): Thanks
I'm not exactly sure what you mean. Align the span where (in relation to the div)? <table style="text-align: center;"> <tr> <td> <span id="currentClaimantName"></span> </td> </tr> <tr> <td> <div id="MedicalBriefsDocumentsTable"></div> </td> </tr> </table> Code (markup):
Someone correct me if I'm wrong but I'm not sure there is a way to get the location of a div that is aligned to center. You can get the location of the div is it's position was set to absolute. Just a question: why not just left align the cells? Then they would both be aligned.