zoukankan      html  css  js  c++  java
  • 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="68px;"/>+<input id="SlopeZYStartMileage2" type="text" class="easyui-validatebox" data-options = "validType:&apos;double&apos;"  precision="8" max="999999999" maxlength="16" min="-999999999"  style="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="68px;"/>+<input id="SlopeZYEndMileage2"  type="text" class="easyui-validatebox" data-options = "validType:&apos;double&apos;"  precision="8" max="999999999" maxlength="16" min="-999999999" style="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="68px;"/>+<input id="SlopeYZStartMileage2" type="text" class="easyui-validatebox" data-options = "validType:&apos;double&apos;" precision="8" max="999999999" maxlength="16" min="-999999999"  style="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="68px;"/>+<input id="SlopeYZEndMileage2"  type="text" class="easyui-validatebox" data-options = "validType:&apos;double&apos;" precision="8" max="999999999" maxlength="16" min="-999999999"  style="68px;"/></div>';
            html += '</fieldset>';
            $('.content').append(html);

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

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

  • 相关阅读:
    浏览器之本地缓存存储 localStorage 和 sessionStorage的区别以及用法
    webpack 命令 Module build failed (from ./node_modules/babel-loader/lib/index.js) 错误问题解决方案
    webpack 4 x使用详细
    JS动态判断设备类型为PC或者移动端,然后根据设备加载相应的代码
    自制弹出框所踩的坑
    ant深入浅出(一)ant+xdoclet 生成hibernate配置文件以及实体映射文件
    收费系统
    自学考试 (二)数据结构图
    ORM框架Hibernate (四)MyEclipse Hibernate Tool 逆向生成实体类
    自学考试 (一)如何利用MindManager工具复习
  • 原文地址:https://www.cnblogs.com/JackeyLove/p/7744278.html
Copyright © 2011-2022 走看看