jquery 动态创建元素,在元素山添加事件

本文深入探讨了操作流程设计与交互体验优化的关键步骤,包括用户界面改进、响应速度提升和人性化反馈机制建立,旨在提高产品的用户体验。通过案例分析,展示了如何通过细致的设计和策略调整,实现从用户需求出发的产品迭代优化。
 $('.l-children>li').each(function(i){
        var str = '';
        $(this).click(function(){
            $('.l-children>li>div').removeClass('l-selected');
            $('.l-children>li').eq(i).children('div').addClass('l-selected');
            var str = '';
            if(i == 1 || i ==4){
                str +='<form action="">';
                str +='<table class="table table-striped table-hover" id="tabel-input">';
                str +='<tr>';
                str +='<th><input type="checkbox" class="trclicks" value="123" id="trclicks" /></th>';
                str +='<th>参数名</th>';
                str +='</tr>';
                str +='<tr>';
                str +='<td><input type="checkbox" name="check" class="trclick" value="" /></td>';
                str +='<td><input type="text" class="form-control" style="width: 300px;" id="field-1" placeholder=""></td>';
                str +='</tr>';
                str +='</table>';
                str +='<div class="form-group" style="margin:5px 0 0 0px;float: right">';
                str +='<input type="submit" class="btn btn-default form-search" style="background-color: #428bca;color: #fffefe;">';
                str +='</div>';
                str +='<div class="form-group" style="margin:5px 10px 0 0px;float: right">';
                str +='<input type="button" class="btn btn-default form-search" style="background-color: #428bca;color: #fffefe;" value="删除" ></div>';
                str +='<div class="form-group" style="margin:5px 10px 0 0px;float: right">';
                str +='<input type="button" class="btn btn-default form-search" style="background-color: #428bca;color: #fffefe;" value="增加" id="add"></div>';
                str +='</form>';
            }else if(i == 2){
                str +='<form action="">';
                str +='<table class="table table-striped table-hover" ><tbody>';
                str +='<tr>';
                str +='<th><input type="checkbox" class="trclicks" value=""  /></th>';
                str +='<th>参数名</th>';
                str +='<th>参数值</th>';
                str +='</tr>';
                str +='<tr>';
                str +='<td><input type="checkbox" name="check[]" class="trclick" value="" /></td>';
                str +='<td><input type="text" class="form-control" style="width: 300px;" id="field-1" placeholder=""></td>';
                str +='<td><input type="text" class="form-control" style="width: 300px;" id="field-1" placeholder=""></td>';
                str +='</tr>';
                str +='</tbody></table>';
                str +='<div class="form-group" style="margin:5px 0 0 0px;float: right">';
                str +='<input type="submit" class="btn btn-default form-search" style="background-color: #428bca;color: #fffefe;">';
                str +='</div></form>';
            }else if( i == 3){
                str +='<form role="form" class="form-horizontal" style="margin-top:15px;">';
                str +='<table class="tables"><tbody>';
                str +='<tr>';
                str +='<td>参数名</td>';
                str +='<td>参数值</td>';
                str +='</tr>';
                str +='<tr>';
                str +='<td>ParameterPath</td>';
                str +='<td><input type="text" class="form-control" id="field-1" placeholder=""></td>';
                str +='</tr>';
                str +='<tr>';
                str +='<td>NextLevel</td>';
                str +='<td>';
                str +='<select class="form-control" id="nextLevel" name="nextLevel">';
                str +='<option value="0">false</option>';
                str +='<option value="1">true</option>';
                str +='</select>';
                str +='</td>';
                str +='</tr>';
                str +='</tbody></table>';
                str +='<div class="form-group" style="margin:5px 0 0 400px">';
                str +='<input type="submit" class="btn btn-default form-search" style="background-color: #428bca;color: #fffefe;">';
                str +='</div> </form>';
            }else if(i==5){
                str +='<form role="form" class="form-horizontal" style="margin-top:15px;">';
                str +='<table class="tables"><tbody>';
                str +='<tr>';
                str +='<td>参数名</td>';
                str +='<td>参数值</td>';
                str +='</tr>';
                str +='<tr>';
                str +='<td>Name</td>';
                str +='<td><input type="text" class="form-control" id="field-1" placeholder=""></td>';
                str +='</tr>';
                str +='<tr>';
                str +='<td>NotificationChange</td>';
                str +='<td>';
                str +='<select class="form-control" id="nextLevel" name="nextLevel">';
                str +='<option value="0">false</option>';
                str +='<option value="1">true</option>';
                str +='</select>';
                str +='</td>';
                str +='</tr>';
                str +='<tr>';
                str +='<td>Notification</td>';
                str +='<td>';
                str +='<select class="form-control" id="notification" name="notification">';
                str +='<option value="0">关闭状态</option>';
                str +='<option value="1">被动上报</option>';
                str +='<option value="2">主动上报</option>';
                str +='</select>';
                str +='</td>';
                str +='</tr>';
                str +='<tr>';
                str +='<td>AccessListChange</td>';
                str +='<td>';
                str +='<select class="form-control" id="accessListChange" name="accessListChange">';
                str +='<option value="0">false</option>';
                str +='<option value="1">true</option>';
                str +='</select>';
                str +='</td>';
                str +='</tr>';
                str +='<tr>';
                str +='<td>AccessList</td>';
                str +='<td>';
                str +='<select class="form-control" id="accessList" name="accessList">';
                str +='<option value="0">Subscriber</option>';
                str +='<option value="1">empty</option>';
                str +='</select>';
                str +='</td>';
                str +='</tr>';
                str +='</tbody></table>';
                str +='<div class="form-group" style="margin:5px 0 0 400px">';
                str +='<input type="submit" class="btn btn-default form-search" style="background-color: #428bca;color: #fffefe;">';
                str +='</div> </form>';
            }else if(i ==6 || i==7){
                str +='<form role="form" class="form-horizontal" style="margin-top:15px;">';
                str +='<table class="tables"><tbody>';
                str +='<tr>';
                str +='<td>参数名</td>';
                str +='<td>参数值</td>';
                str +='</tr>';
                str +='<tr>';
                str +='<td>objectName</td>';
                str +='<td><input type="text" class="form-control" id="field-1" placeholder=""></td>';
                str +='</tr>';
                str +='<tr>';
                str +='<td>parameterKey</td>';
                str +='<td>';
                str +='<input type="text" class="form-control" id="field-1" placeholder="">';
                str +='</td>';
                str +='</tr>';
                str +='</tbody></table>';
                str +='<div class="form-group" style="margin:5px 0 0 400px">';
                str +='<input type="submit" class="btn btn-default form-search" style="background-color: #428bca;color: #fffefe;">';
                str +='</div> </form>';
            }else if(i==8){
                str +='<button class="btn btn-info btn-icon" style="margin-left: 10px">重启</button>';
                str +='<div style="width:100%;"> <table align="center"><tbody>';
                str +='<tr>';
                str +='<th>重启结果</th>';
                str +='<td id="errorInfo"></td>';
                str +='</tr>';
                str +='</tbody> </table></div>';
            }else if(i==9){
                str +='<button class="btn btn-info btn-icon" style="margin-left: 10px">恢复出厂设置</button>';
                str +='<div style="width:100%;"> <table align="center"><tbody>';
                str +='<tr>';
                str +='<th>操作结果</th>';
                str +='<td id="errorInfo"></td>';
                str +='</tr>';
                str +='</tbody> </table></div>';
            }else if(i==10){
                str +='<form role="form" class="form-horizontal" style="margin-top:15px;">';
                str +='<table class="tables" ><tbody>';
                str +='<tr>';
                str +='<td>文件类型</td>';
                str +='<td>';
                str +='<select class="form-control" id="notification" name="notification"  style="width: 200px;float: left">';
                str +='<option value="0">1 Vendor Configuration File</option>';
                str +='<option value="1">2 Vendor Log File</option>';
                str +='</select>';
                str +='<span style="float: left;margin:5px 0 0 5px;"><font color="#a52a2a">*</font></span></td>';
                str +='</tr>';
                str +='<tr>';
                str +='<td>url</td>';
                str +='<td><input type="text" class="form-control" style="width: 200px;float: left" id="field-1" placeholder=""><span style="float: left;margin:5px 0 0 5px;"><font color="#a52a2a">*</font><font color="#5f9ea0">1~256个字符</font></span></td>';
                str +='</tr>';
                str +='<tr>';
                str +='<td>用户名</td>';
                str +='<td><input type="text" class="form-control" id="field-1" placeholder=""  style="width: 200px;float: left"></td>';
                str +='</tr>';
                str +='<tr>';
                str +='<td>密码</td>';
                str +='<td><input type="text" class="form-control" id="field-1" placeholder=""  style="width: 200px;float: left"></td>';
                str +='</tr>';
                str +='<tr>';
                str +='<td>延迟时间</td>';
                str +='<td><input type="text" class="form-control" id="field-1" placeholder=""  style="width: 200px;float: left"><span style="float: left;margin:5px 0 0 5px;"><font color="#a52a2a">*</font><font color="#5f9ea0">1~8个字符</font></span></td>';
                str +='</tr>';
                str +='</tbody></table>';
                str +='<div class="form-group" style="margin:5px 0 0 400px">';
                str +='<input type="submit" class="btn btn-default form-search" style="background-color: #428bca;color: #fffefe;">';
                str +='</div> </form>';
            }else if(i==11){
                str +='<form role="form" class="form-horizontal" style="margin-top:15px;">';
                str +='<table class="tables2" ><tbody>';
                str +='<tr>';
                str +='<td>文件类型</td>';
                str +='<td>';
                str +='<select class="form-control" id="notification" name="notification"  style="width: 300px;float: left">';
                str +='<option value="0">------请选择一种文件类型------</option>';
                str +='<option value="1">Firmware_Upgrade_Image</option>';
                str +='<option value="1">Web_Content</option>';
                str +='<option value="2">Vendor_Configuration_File</option>';
                str +='</select>';
                str +='<span style="float: left;margin:5px 0 0 5px;"><font color="#a52a2a">*</font></span></td>';
                str +='</tr>';
                str +='<tr>';
                str +='<td>url</td>';
                str +='<td><input type="text" class="form-control" style="width: 300px;float: left" id="field-1" placeholder=""><span style="float: left;margin:5px 0 0 5px;"><font color="#a52a2a">*</font><font color="#5f9ea0">1~256个字符</font></span></td>';
                str +='</tr>';
                str +='<tr>';
                str +='<td>用户名</td>';
                str +='<td><input type="text" class="form-control" id="field-1" placeholder=""  style="width: 300px;float: left"></td>';
                str +='</tr>';
                str +='<tr>';
                str +='<td>密码</td>';
                str +='<td><input type="text" class="form-control" id="field-1" placeholder=""  style="width: 300px;float: left"></td>';
                str +='</tr>';
                str +='<tr>';
                str +='<td>文件大小(以字节为单位)</td>';
                str +='<td><input type="text" class="form-control" style="width: 300px;float: left" id="field-1" placeholder=""><span style="float: left;margin:5px 0 0 5px;"><font color="#a52a2a">*</font><font color="#5f9ea0">1~32个字符</font></span></td>';
                str +='</tr>';
                str +='<tr>';
                str +='<td>文件名称</td>';
                str +='<td><input type="text" class="form-control" style="width: 300px;float: left" id="field-1" placeholder=""><span style="float: left;margin:5px 0 0 5px;"><font color="#a52a2a">*</font><font color="#5f9ea0">1~256个字符</font></span></td>';
                str +='</tr>';
                str +='<tr>';
                str +='<td>安装方式</td>';
                str +='<td>';
                str +='<select class="form-control" id="anzhuang" name="anzhuang" style="width: 300px;float: left" >';
                str +='<option value="0">---请选择---</option>';
                str +='<option value="1">非静默</option>';
                str +='<option value="2">静默</option>';
                str +='</select>';
                str +='</td>';
                str +='</tr>'
                str +='<tr>';
                str +='<td>是否强制升级</td>';
                str +='<td>';
                str +='<select class="form-control" id="qianzhi" name="qianzhi" style="width: 300px;float: left" >';
                str +='<option value="0">非强制</option>';
                str +='<option value="1">强制</option>';
                str +='</select>';
                str +='</td>';
                str +='</tr>'
                str +='<tr>';
                str +='<td>延迟时间</td>';
                str +='<td><input type="text" class="form-control" id="field-1" placeholder=""  style="width: 300px;float: left"><span style="float: left;margin:5px 0 0 5px;"><font color="#a52a2a">*</font><font color="#5f9ea0">1~8个字符</font></span></td>';
                str +='</tr>';
                str +='<tr>';
                str +='<td>successUrl</td>';
                str +='<td><input type="text" class="form-control" style="width: 300px;float: left" id="field-1" placeholder=""></td>';
                str +='</tr>';
                str +='<tr>';
                str +='<td>failureUrl</td>';
                str +='<td><input type="text" class="form-control" style="width: 300px;float: left" id="field-1" placeholder=""></td>';
                str +='</tr>';
                str +='</tbody></table>';
                str +='<div class="form-group" style="margin:5px 0 0 400px">';
                str +='<input type="submit" class="btn btn-default form-search" style="background-color: #428bca;color: #fffefe;">';
                str +='</div> </form>';
            } else{
                str +='<button class="btn btn-info btn-icon" type="submit">刷新</button>';
            }
            $('#showtable').html(str);
        })
    })
页面更新会丢失事件绑定,要绑定到document中
中间那改为

$(document).on('click', '.trclicks', function(){
    var ischeck = this.checked;
    $.each($(".trclick"),function(i,item){
        item.checked=ischeck;
    });
});


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值