jQuery 针对同一元素的多个函数操作的写法

来源:互联网 发布:阿基米德软件下载 编辑:程序博客网 时间:2024/05/26 08:43

jQuery 针对同一元素,如果同时需要对其进行多个函数的操作,开发时大可不必一个一个的写,可以采用串写的方式;

冗余方式: $("#mailpassword").click(function(){
$(this).val("");
$(this).val("").attr("type","password").css({"text-decoration":"none","color":'#666666','cursor':'text'});
$(this).val("").css({"text-decoration":"none","color":'#666666','cursor':'text'});
});
建议方式:$("#mailpassword").click(function(){        $(this).val("").attr("type","password").css({"text-decoration":"none","color":'#666666','cursor':'text'});    });

阅读全文
0 0
原创粉丝点击