jquery fail to retrieve accurate data from sibling field.

Posted by i need help on Stack Overflow See other posts from Stack Overflow or by i need help
Published on 2010-04-07T09:28:13Z Indexed on 2010/04/07 9:33 UTC
Read the original article Hit count: 229

Filed under:
|
|
|

wonder what's wrong

<table id=tblDomainVersion>

<tr>
    <td>Version</td>
    <td>No of sites</td>
</tr>

<tr>
    <td class=clsversion>1.25</td>
    <td><a id=expanddomain>3 sites</a><span id=spanshowall></span></td>
</tr>

<tr>
    <td class=clsversion>1.37</td>
    <td><a id=expanddomain>7 sites</a><span id=spanshowall></span></td>
</tr>

</table>


$('#expanddomain').click(function() {

    //the siblings result incorrect
    //select first row will work
    //select second row will no response

    var versionforselected= $('#expanddomain').parent().siblings("td.clsversion").text();
    alert(versionforselected);

    $.ajax({

        url: "ajaxquery.php",
            type: "POST",

        data: 'version='+versionforselected,

        timeout: 900000,                                  

        success:  function(output) {                            

            output= jQuery.trim(output);
            $('#spanshowall').html(output);
        },

    });




});

© Stack Overflow or respective owner

Related posts about first

Related posts about sibling