jquery常用代码总结

来源:互联网 发布:陶瓷软件 编辑:程序博客网 时间:2024/05/21 10:41

1.ready方法

//可以用来测验 jquery是否加载成功$(document).ready(function(){alert(11);})//简版$(function(){   alert(11);})

2.遍历

$("input:checked").each(function(){           $(this).attr("id");})$("input[readonly='true']:not([onclick])").each(function(){           $(this).css("color","#CECED1");})

3.搜索内容高亮显示

var val = "所搜的内容";$("#contentDiv font").each(function(){    $(this).html($(this).text().replace(val,"<font color='red'>"+val+"</font>"));})

待续。。。

原创粉丝点击