js 生成的html class属性失效问题

        var html = '<fieldset class="struct-info" id="SlopeZY"><legend>变坡点(ZY)</legend>';
        html += '<input type="hidden" id="SlopeZYId" name="SlopeZYId"/>';
        if (me.Paras.IsUseCircle != undefined && me.Paras.IsUseCircle == 'True') {
            html += '<div class="row"><label for="SlopeZYStartCircle">开始环号:</label><input id="SlopeZYStartCircle" type="text" class="easyui-numberbox"  precision="0" max="999999999" maxlength="16" min="-999999999" /></div>';
            html += '<div class="row"><label for="SlopeZYEndCircle">结束环号:</label><input id="SlopeZYEndCircle" type="text" class="easyui-numberbox"  precision="0" max="999999999" maxlength="16" min="-999999999"/></div>';
        }
        html += '<div class="row"><label for="SlopeZYStartMileage">开始里程:</label>' + me.Paras.prefix +'<input id="SlopeZYStartMileage1" type="text" class="easyui-validatebox" data-options = "validType:&apos;numberWithZero&apos;"  precision="8" max="999999999" maxlength="16" min="-999999999"  style="width:68px;"/>+<input id="SlopeZYStartMileage2" type="text" class="easyui-validatebox" data-options = "validType:&apos;double&apos;"  precision="8" max="999999999" maxlength="16" min="-999999999"  style="width:68px;"/></div>';
        html += '<div class="row"><label for="SlopeZYEndMileage">结束里程:</label>' + me.Paras.prefix +'<input id="SlopeZYEndMileage1" type="text" class="easyui-validatebox" data-options = "validType:&apos;numberWithZero&apos;" precision="8" max="999999999" maxlength="16" min="-999999999" style="width:68px;"/>+<input id="SlopeZYEndMileage2"  type="text" class="easyui-validatebox" data-options = "validType:&apos;double&apos;"  precision="8" max="999999999" maxlength="16" min="-999999999" style="width:68px;"/></div>';
        html += '</fieldset>';
        html += '<fieldset class="struct-info" id="SlopeYZ"><legend>变坡点(YZ)</legend>';
        html += '<input type="hidden" id="SlopeYZId" name="SlopeYZId"/>';
        if (me.Paras.IsUseCircle != undefined && me.Paras.IsUseCircle == 'True') {
            html += '<div class="row"><label for="SlopeYZStartCircle">开始环号:</label><input id="SlopeYZStartCircle" type="text" class="easyui-numberbox"  precision="0" max="999999999" maxlength="16" min="-999999999"/></div>';
            html += '<div class="row"><label for="SlopeYZEndCircle">结束环号:</label><input id="SlopeYZEndCircle" type="text" class="easyui-numberbox"  precision="0" max="999999999" maxlength="16" min="-999999999"/></div>';
        }
        html += '<div class="row"><label for="SlopeYZStartMileage">开始里程:</label>' + me.Paras.prefix +' <input id="SlopeYZStartMileage1" type="text" class="easyui-validatebox" data-options = "validType:&apos;numberWithZero&apos;" precision="8" max="999999999" maxlength="16" min="-999999999" style="width:68px;"/>+<input id="SlopeYZStartMileage2" type="text" class="easyui-validatebox" data-options = "validType:&apos;double&apos;" precision="8" max="999999999" maxlength="16" min="-999999999"  style="width:68px;"/></div>';
        html += '<div class="row"><label for="SlopeYZEndMileage">结束里程:</label>' + me.Paras.prefix +' <input id="SlopeYZEndMileage1" type="text" class="easyui-validatebox" data-options = "validType:&apos;numberWithZero&apos;" precision="8" max="999999999" maxlength="16" min="-999999999" style="width:68px;"/>+<input id="SlopeYZEndMileage2"  type="text" class="easyui-validatebox" data-options = "validType:&apos;double&apos;" precision="8" max="999999999" maxlength="16" min="-999999999"  style="width:68px;"/></div>';
        html += '</fieldset>';
        $('.content').append(html);

问题描述:通过js添加的输入框,带有easyui-validatebox 验证,但是到前台后,发现验证失效了。

 

 

解决办法:在append方法调用后 添加   $.parser.parse($('.content')); 手动激活有效性。

转载于:https://www.cnblogs.com/JackeyLove/p/7744278.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值