我是靠谱客的博主 温柔羊,最近开发中收集的这篇文章主要介绍jq点击增加一段html,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<!--添加广告位信息开始-->
< div  class = "all"  style = "" >
     < div  class = "widget-header" >
         < h4 >广告位明细(最多5条)</ h4 >< div  style = "float:right;margin-right: 50px; cursor: pointer;" >< h4  id = "newyz1" >+增加</ h4 ></ div >
     </ div >
     < div  class = "one1" >
         < div  class = "contract-contracttype" >
             < div  class = "form-group field-contract-contracttype required has-success" >
                 < label  class = "col-sm-1 control-label no-padding-right"  for = "receivableamount[contractId]" >广告位</ label >
                 < div  class = "col-lg-2" >
                     < input  type = "hidden"  class = "advertId"  name = "advertId[]"  id = "advertId"  value = "" >
                     < input  type = "hidden"  class = "advertname1"  name = "advertname1[]"  id = "advertname1"  value = "" >
                     < select  id = "port"  class = "form-control port"  name = "port[]"  onchange = "checkadvertname(this);" >
                         <? php  foreach($port as $key=>$value):?>
                         < option  value="<?=$value['key']?>"><?=$value['value']?></ option >
                         <? php  endforeach;?>
                     </ select >
                 </ div >
                 < div  class = "col-lg-2" >
                     < select  id = "page"  class = "form-control page"  name = "page[]"  onchange = "checkadvertname(this);" >
                         <? php  foreach($page as $key=>$value):?>
                             < option  value="<?=$value['key']?>"><?=$value['value']?></ option >
                         <? php  endforeach;?>
                     </ select >
                 </ div >
                 < div  class = "col-lg-2" >
                     < select  id = "advertname"  class = "form-control advertname"  name = "advertname[]"  onchange = "getadvert(this)" >
                         < option  value = "0" >请选择广告位</ option >
                     </ select >
                 </ div >
 
             </ div >
         </ div >
         < div  class = "form-group field-applypay-paymenttime" >
             < label  class = "col-sm-1 control-label no-padding-right"  for = "applypay-paymenttime" >发布时间</ label >
             < div  class = "col-sm-3 col-lg-2" >
                 < div  class = "input-group" >
                     < span  class = "input-group-addon" >< i  class = "icon-calendar bigger-110" ></ i ></ span >
                     < input  class = "form-control date-picker datetime-picker3"  id = "projectStime"  name = "projectStime[]"  data-date-format = "dd-mm-yyyy"  onfocus = "WdatePicker({dateFmt:'yyyy-MM-dd'})"  type = "text" >
                     < em  style = "position: absolute; top: 5px; right: -28px; width: 20px;" >-</ em >
                 </ div >
             </ div >
             < div  class = "col-sm-3 col-lg-2" >
                 < div  class = "input-group" >
                     < span  class = "input-group-addon" >< i  class = "icon-calendar bigger-110" ></ i ></ span >
                     < input  class = "form-control date-picker datetime-picker3"  id = "projectEtime"  name = "projectEtime[]"  data-date-format = "dd-mm-yyyy"  onfocus = "WdatePicker({dateFmt:'yyyy-MM-dd'})"  type = "text" >
                 </ div >
             </ div >
         </ div >
         < div  class = "form-group field-receivableamout-reason required" >
             < label  class = "col-sm-1 control-label no-padding-right"  for = "receivableamout-reason" >备注说明</ label >
             < div  class = "col-lg-5" >< input  type = "text"  id = "receivableamout-reason"  class = "form-control"  name = "reason[]"  maxlength = "100" ></ div >
             < div  class = "col-lg-3" >
                 < div  class = "help-block" ></ div ></ div >
         </ div >
 
     </ div >
     < span  class = "form-group"  id = "xx" >
 
     </ span >
     < div  class = "form-group field-receivableamout-reason required" >
         < label  class = "col-lg-1 control-label no-padding-right"  for = "receivableamout-reason" >上传附件</ label >
         < div  class = "col-lg-11 wdata1" >
             < div  class = "col-lg-3 btnimg" >
                 < label  for = "uploadImg"  class = "btn btn-primary fileimg" >< i  class = "fa-plus-sign" ></ i >
                     < span >上传</ span >
                     < input   class = "UploadImg"  data = "1"   type = "file"  name = "files[]"   multiple></ label >
                 </ label >
             </ div >
 
         </ div >
     </ div >
</ div >
<!--添加广告位信息结束-->
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
  $("#newyz1").bind('click',function() {
                     _addnum++;
                     var num=_addnum;
                     console.log(num);
                     if($(".one1").length>4){
                         layer.msg("最多5条数据");
                         return false;
                     }
                     var html='< div  class = "one1" >n' +
                         '                < div  class = "contract-contracttype" >n' +
                         '                    < div  class = "form-group field-contract-contracttype required has-success" >n' +
                         '< input  type = "hidden"  class = "advertId"  name = "advertId[]"  id = "advertId"  value = "" >n'+
                         ' < input  type = "hidden"  class = "advertname1"  name = "advertname1[]"  id = "advertname1"  value = "" >n'+
                         '                        < label  class = "col-sm-1 control-label no-padding-right"  for = "receivableamount[contractId]" >广告位</ label >n' +
                         '                    < a  href = "javascript:void(0)"  class = "khnimus1"  title = ""  id = "newyz1"  data-original-title = "" >< i  class = "icon-trash bigger-130" ></ i ></ a >n'+
                         '                        < div  class = "col-lg-2" >n' +
                         '                            < select  id = "port"  class = "form-control port"  name = "port[]"  onchange = "checkadvertname(this);" >n';
                     for (var i=0;i< ports.length ;i++){
                         html+='<option  value = '+ports[i][' key']+'>'+ports[i]['value']+'</ option >';
                     }
                     html+='</ select >n' +
                         '                        </ div >n' +
                         '                        < div  class = "col-lg-2" >n' +
                         '                            < select  id = "page"  class = "form-control page"  name = "page[]"  onchange = "checkadvertname(this);"  >n';
                     for (var i=0;i< pages.length ;i++){
                         html+='<option  value = '+pages[i][' key']+'>'+pages[i]['value']+'</ option >';
                     }
                     html+='</ select >n' +
                         '                            </ select >n' +
                         '                        </ div >n' +
                         '                        < div  class = "col-lg-2" >n' +
                         '                            < select  id = "advertname"  class = "form-control advertname"  name = "advertname[]"  onchange = "getadvert(this)"  >n' +
                         '                                < option  value = "0" >请选择广告位</ option >n' +
                         '                            </ select >n' +
                         '                        </ div >n' +
                         'n' +
                         '                    </ div >n' +
                         '                </ div >n' +
                         '                < div  class = "form-group field-applypay-paymenttime" >n' +
                         '                    < label  class = "col-sm-1 control-label no-padding-right"  for = "applypay-paymenttime" >发布时间</ label >n' +
                         '                    < div  class = "col-sm-3 col-lg-2" >n' +
                         '                        < div  class = "input-group" >n' +
                         '                            < span  class = "input-group-addon" >< i  class = "icon-calendar bigger-110" ></ i ></ span >n' +
                         '                            < input  class = "form-control date-picker datetime-picker3"  id = "projectStime"  name = "projectStime[]"  data-date-format = "dd-mm-yyyy"  onfocus = "WdatePicker({dateFmt:'yyyy-MM-dd'})"  type = "text" >n' +
                         '                            < em  style = "position: absolute; top: 5px; right: -28px; width: 20px;" >-</ em >n' +
                         '                        </ div >n' +
                         '                    </ div >n' +
                         '                    < div  class = "col-sm-3 col-lg-2" >n' +
                         '                        < div  class = "input-group" >n' +
                         '                            < span  class = "input-group-addon" >< i  class = "icon-calendar bigger-110" ></ i ></ span >n' +
                         '                            < input  class = "form-control date-picker datetime-picker3"  id = "projectEtime"  name = "projectEtime[]"  data-date-format = "dd-mm-yyyy"  onfocus = "WdatePicker({dateFmt:'yyyy-MM-dd'})"  type = "text" >n' +
                         '                        </ div >n' +
                         '                    </ div >n' +
                         '                </ div >n' +
                         '                < div  class = "form-group field-receivableamout-reason required" >n' +
                         '                    < label  class = "col-sm-1 control-label no-padding-right"  for = "receivableamout-reason" >备注说明</ label >n' +
                         '                    < div  class = "col-lg-5" >< input  type = "text"  id = "receivableamout-reason"  class = "form-control"  name = "reason[]"  maxlength = "100" ></ div >n' +
                         '                    < div  class = "col-lg-3" >n' +
                         '                        < div  class = "help-block" ></ div ></ div >n' +
                         '                </ div >n' +
//                            ' < div  class = "form-group field-receivableamout-reason required" >n' +
//                        '                    < label  class = "col-lg-1 control-label no-padding-right"  for = "receivableamout-reason" >上传附件</ label >n' +
//                        '                    < div  class = "col-lg-11 wdata'+num+'" >n' +
//                        '                        < div  class = "col-lg-3 btnimg" >n' +
//                        '                            < label  for = "uploadImg"  class = "btn btn-primary fileimg" >< i  class = "fa-plus-sign" ></ i >n' +
//                        '                                < span >上传</ span >n' +
//                        '                                < input   class = "UploadImg"  data = "'+num+'"   type = "file"  name = "files[]"   multiple></ label >n' +
//                        '                            </ label >n' +
//                        '                        </ div >n' +
//                        '                    </ div >n' +
//                        '                </ div >n'+
                     '</ div >';
                     $('#xx').append(html);
 
                     //jq上传插件开始
                     $(".UploadImg").fileupload({
                         url: 'http://imgapi.qq.com/upload/php/upload.php',
                         sequentialUploads: true,
                         formData: {"app": 'brzy'},
                         returnType: "json",
                         acceptFiles: "application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,text/*,image/*,.pdf,.zip,.rar,.doc,.docx",
                         dataType: 'json',
 
// 上传完成后的执行逻辑
                         done: function (e, data) {
                             var n = data.jqXHR.responseText;
                             var an = JSON.parse(n);
                             // console.log(an);
                             layer.closeAll();
                             // if(typeof(_clickBut)=='undefined'){
                             //     var _clickBut='';
                             // }
                             _clickBut = $(this).attr('data');//哪个按钮被点击了
                             console.log($(this));
                             callback(an.url);
                         },
// 上传过程中的回调函数
                         progressall: function (e, data) {
                             layer.load(0, {shade: false});
                         }
                     });
 
                     //jq插件结束
                     $(".khnimus1").live('click',function(){
                         $(this).parents(".one1").remove();
                     });
                 });


最后

以上就是温柔羊为你收集整理的jq点击增加一段html的全部内容,希望文章能够帮你解决jq点击增加一段html所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(50)

评论列表共有 0 条评论

立即
投稿
返回
顶部