jquery 设置属性 滑动 绑定事件 中断 横列表 手效果 中文正则

来源:互联网 发布:mac桌面壁纸文件夹 编辑:程序博客网 时间:2024/05/20 14:23

设置隐藏属性

设置$("#ss").attr("cphonename",f.attr("alt"));读取$("#ss").attr("cphonename");

滑动效果

<script>$(document).ready(function(){  $("#hide").click(function(){      if($("#left").css('width') == '200px'){          $("#left").animate({width:0},"slow");          $("#hide").val('显示');    }else{        $("#left").animate({width:200},"slow");        $("#hide").val('隐藏');    }});});</script><div id="left" style="width:200px; background-color:#009900; float:left;"> </div><div id="right" style="width:400px; background-color: #FF0000; float:left;"> </div><div style="float:left"><input id="hide" type="button" value="隐藏" /></div>

绑定事件

$('p').click(function(e){    $(e.currentTarget)  //获取当前点击的元素})$('p').unbind(); //清除绑定的事件

中断加载

throw new Error('error')

radio选择

$(":radio[name='phoneList'][value='" + tempname + "']").prop("checked", "checked");

横向列表

<ul class="hul">    <li>1</li>    <li>2</li></ul>.hul li{        text-decoration: none;//去掉li前面的圆点        list-style: none;        display: inline;//让li横向排列    }

保留小数后多少位

a = 1.22228a.toFixed(2)  保留两位小数

用css 添加手状样式,鼠标移上去变小手,变小手

cursor:pointer;

判断包含中文正则

/.*[\u4e00-\u9fa5]+.*$/.test("中文") js 检测是否为中文
原创粉丝点击