下一个TD的第一个TD

Mar*_*ndy 2 html javascript jquery

我有:

<table>
    <tr class="here">
        <td class="first">first</td>
        <td class="next" par="http://google.com">next</td>
        <td class="next" par="http://stackoverflow.com">next</td>
    </tr>
</table>
Run Code Online (Sandbox Code Playgroud)

直播:http://jsfiddle.net/C5vSP/

我想收到jQuery:

<table>
    <tr class="here">
        <td class="first"><a href="http://google.com">first</a></td>
        <td class="next" par="http://google.com">next</td>
        <td class="next" par="http://stackoverflow.com">next</td>
    </tr>
</table>
Run Code Online (Sandbox Code Playgroud)

这必须从第一个TD.next获得参数par,并使用此参数在第一个TD中建立链接.

可以使用jQuery吗?如果有,怎么样?

编辑: 谢谢你的回答.对于所有+1.我还有一个问题:

<table>
    <tr class="here">
        <td class="first">first</td>
        <td class="next" par="http://google.com">next</td>
        <td class="next" par="http://stackoverflow.com">next</td>
    </tr>
        <tr class="here">
        <td class="first">first</td>
        <td class="next" par="http://yahoo.com">next</td>
        <td class="next" par="http://stackoverflow.com">next</td>
    </tr>
        <tr class="here">
        <td class="first">first</td>
        <td class="next" par="http://cnn.com">next</td>
        <td class="next" par="http://stackoverflow.com">next</td>
    </tr>
</table>
Run Code Online (Sandbox Code Playgroud)

现场:http://jsfiddle.net/C5vSP/2/

此添加适用于所有.here链接google.com而不是google.com,yahoo.com和cnn.com.我不能修改HTML.我只能使用jQuery.我怎样才能正确地做到这一点?

j08*_*691 7

怎么回事:jsFiddle

var url =  $('td.next:first').attr('par');
$('td.first').wrapInner('<a href="'+url+'">');
Run Code Online (Sandbox Code Playgroud)