jquery常用指令

table中td多行展示:

```css
td {
   word-wrap: break-word;
}
```

div模态框:

 <div id="loading" style="display: none;">
        <div id="loading2">
        </div>
        <img id="loading2img" src="" alt="">
 </div>	
 
   <%--加载模态框样式--%>
        #loading {
            display: none;
            position: fixed;
            top: 0%;
            left: 0%;
             100%;
            height: 100%;
            z-index: 1010;
            -moz-opacity: 0.8;
            opacity: .80;
            filter: alpha(opacity=80);
            background: rgba(255, 255, 0, 0.4);
        }

        #loading2 {
            position: absolute; /*绝对定位*/
            top: 50%; /* 距顶部50%*/
            left: 50%; /* 距左边50%*/
            height: 200px;
            margin-top: -100px; /*margin-top为height一半的负值*/
             200px;
            margin-left: -100px; /*margin-left为width一半的负值*/
            background: rgba(255, 255, 0, 0.4);

            z-index: 1011;
            overflow: hidden;
        }

        #loading2img {
            position: absolute; /*绝对定位*/
            top: 50%; /* 距顶部50%*/
            left: 50%; /* 距左边50%*/
            height: 200px;
            margin-top: -100px; /*margin-top为height一半的负值*/
             200px;
            margin-left: -100px; /*margin-left为width一半的负值*/
            z-index: 1;
        }
 
	//$("#loading").css("display", "block"); 显示 
	//$("#loading").hide() 隐藏
	
	
	 

绑定点击事件

 $(".xxx").bind('click', function () {}

寻找节点

孩子 .children() 第一个孩子:.children(":first") 最后一个.children(":last")
兄弟 .next()

标签内容:

.text()
包含xx .indexOf("xx")
获取属性 .attr("xx") 设置属性:.attr({"class": "disabled"})
获取html .html()
移除class .removeClass("disabled")

获取name为score的input的值: $("input[name='score']").val(); 或 $("[name='score']").val();
id模糊匹配:以xx开头的div: (("div[id^=xx]") 以xx结尾的div:)("div[id$=xx]")

原文地址:https://www.cnblogs.com/fly-book/p/10540610.html