Js、JQuery脚本兼容

1、获取属性值

IE:$("#xxx").prop("title");

chrome:$("#xxx").attr("title");

2、checkbox、radio 选中值

document.getElementById("xxx").checked 

获取 radio 选择只能循环遍历 

var ids="";
            var list = document.getElementsByName("course_list");
            for(i=0;i<list.length;i++)
                {
                   if(list[i].checked==true){
                     ids+=list[i].id+",";  
                   }
                }
            alert(ids);

 3、text-overflow : clip | ellipsis

取值:
clip : 默认值。不显示省略标记(...),而是简单的裁切 
ellipsis : 当对象内文本溢出时显示省略标记(...)

无兼容性问题:

290px;

需要设置不换行

white-space: nowrap;

4、kindeditor linux 获取值失败

放到Linux下面 frame就少了一层。在本地层次没有错。

本地windows 环境:$(document.getElementsByTagName("iframe")[1].contentWindow.document.body).html();

linux 环境:$(document.getElementsByTagName("iframe")[0].contentWindow.document.body).html();

如果使用form 提交就不会出现这个问题。


 white-space:nowrap;text-overflow:ellipsis;-o-text-overflow:ellipsis;overflow:hidden;

原文地址:https://www.cnblogs.com/Peter-Youny/p/4116647.html