15年软件开发经验 只做源码定制 互联网+定制化解决方案

15年软件开发经验,只做源码定制!

原创设计 定制开发

满足您的个性化需求

当前位置:首页 前端开发 H5

使用jQuery动态在网页中添加输入框

李石超| 发布于 2022-03-19 09:42:07| 215阅读| 0点赞| 0评论
举报

使用jQuery动态在网页中添加输入框,参考上传多图的代码修改而成,使用thinkphp5框架渲染数据

效果:点击‘添加按钮’,添加两个一对的输入框


html部分代码:

<thead>
            <tr>
              <th>项目th>
              <th>材料名称th>
              <th>
                <button type="button" class="layui-btn layui-btn-xs layui-btn-primary" style="margin-right: 0;font-size:12px;" id="add_jscs_tr">添加button>
              th>
            tr>
          thead>
          <tbody id="jishucanshu_inputs">
            {notempty name="$data.jishucanshu"}
              {volist name="$data.jishucanshu" id='jscs1'}
              <tr class="del operate">
                <td><input type="text" name="jscs_one[]" {notempty name="$jscs1[0]"}value="{$jscs1[0]}"{/notempty}>td>
                <td><textarea id="symptomTxt" style="height:auto;" style="" name="jscs_two[]">{notempty name="$jscs1[1]"}{$jscs1[1]}{/notempty}textarea>td>
                <td>
                  <button type="button" class="layui-btn layui-btn-xs layui-btn-primary delete" style="margin-right: 0;font-size:12px;">删除button>
                td>
              tr>
              {/volist}
            {/notempty}
          tbody>

jQuery部分代码:

//技术参数-添加输入框
    $('#add_jscs_tr').click(function() {
        var html='">" name="jscs_one[]">'+
                  '
                            
  • 微信扫一扫立即咨询
    账号登录|扫码登录

    立即注册 |忘记密码?

    欢迎注册

    已有账号马上登录

    重置密码

    扫码绑定微信
    微信扫一扫

    绑定手机号

    分享到-微信

    举报

    • 举报类型:

    • 举报描述:

    您好,当前积分不足。

    在线客服
    拨打电话
    17330196230 13230981129
    顶部