zoukankan      html  css  js  c++  java
  • 避免使用jQuery的html方法来替换标签,而是使用replaceWith方法

    tblCostSplit.html内容:
    <nobr title="">只想显示里面内容,去掉nobr标签</nobr>
    <nobr title="">只想显示里面内容,去掉nobr标签</nobr>
    <nobr title="">只想显示里面内容,去掉nobr标签</nobr>
     
    (1)html方法,会导致原来Dom内容的绑定事件出现错误,不建议使用
    tblCostSplit.html(tblCostSplit.html().replace(/<nobr.*?>/ig"").replace(/</nobr>/ig""));  
     
    (2)replaceWith方法,能正常替代标签,建议使用
    jQuery("nobr", tblCostSplit).each(function () {
        jQuery(this).replaceWith(jQuery(this).html());
    });
  • 相关阅读:
    监听
    用户管理
    oracle网络
    实例 参数
    存储管理
    oracle 体系
    实例
    修改
    集合操作
    17.08.18
  • 原文地址:https://www.cnblogs.com/huangjianwu/p/4536358.html
Copyright © 2011-2022 走看看