h5样式

禁止长按默认事件

  安卓(android):

    window.ontouchstart = function(e) {
      e.preventDefault();
    };

  苹果(ios):

    -webkit-touch-callout: none;

 

textarea中换行无法被浏览器识别问题:

  /*
   * 根据Value格式化为带有换行、空格格式的HTML代码
   * @param strValue {String} 需要转换的值
   * @return {String}转换后的HTML代码
   * @example
   * getFormatCode("测\r\n\s试") => “测<br/> 试”
   */
  var getFormatCode = function(strValue){
    return strValue.replace(/\r\n/g, '<br/>').replace(/\n/g, '<br/>').replace(/\s/g, ' ').replace(/\s/g, '&nbsp; ');
  }

 

posted @ 2020-03-16 11:13  文争青  阅读(322)  评论(0)    收藏  举报