Skip to content Skip to sidebar Skip to footer

Getting HTML Table Row Position And Showing Div Next To It

I've managed to show
which contains a relevant image to the table row, but I want my
to appear next to the clicked row like this: In this example, when use

Solution 1:

Here is an example to get you started using jQuery - http://jsfiddle.net/CtWSf/

$('td').click(function(e){
    var currentPosition = $(this).offset();
    $('.results').html(currentPosition.top);
});

For this markup -

<table>
    <tr><td>1</td></tr>
    <tr><td>2</td></tr>
    <tr><td>3</td></tr>
    <tr><td>4</td></tr>
    <tr><td>5</td></tr>
</table>
<div class="results"></div>

Post a Comment for "Getting HTML Table Row Position And Showing Div Next To It"