V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
linuxs
V2EX  ›  前端开发

jquery 如果把获取到的值,循环添加到 td 中?

  •  
  •   linuxs · 2017-11-13 20:58:12 +08:00 · 1930 次点击
    这是一个创建于 2349 天前的主题,其中的信息可能已经有所发展或是发生改变。
    html:
    <tbody>
    <tr>
    <td id="myid"></td>
    <td id="myip"></td>
    </tr>
    </tbody>
    </table>
    ---------------------------------------------------------------------------------------------------
    jquery:

    function getall() {
    var ids=""
    var ips=""
    $("input[name='selected']").each(function(){
    if($(this).is(":checked")){
    var id=$(this).attr("id");
    ids=ids+id+","
    var ip=$("#netip" + id).html()
    ips=ips+ip+","
    }
    });

    $("#myid").html(ids);
    $("#myip").html(ips);
    }
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2845 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 06:10 · PVG 14:10 · LAX 23:10 · JFK 02:10
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.