ITeye博客

JQuery

共 2 篇文章

Jquery常用

修改样式 if (now == null || now == "" || now == "null") { // 注意字符串"null" now = "opt_11"; } $("#"+now).css("display", ""); $("#img"+now).attr("src","images/index/close.gif"); $("#img"+now).attr("alt","收起"); 1、div // 设值 $("#div_id").text(''); // 隐藏 $("#div_id").hide(); 2、input // this this.value // 取值 //…

2011-07-30 16:24 · JQuery

JQuery入门 -- 01 -- API

1、HelloWord $(document).ready(function(){ alert("Hello Word!!!"); }); //或者更简单点: $(function(){ alert("Hello Word!!!"); }); 2、与DOM对象的转换: //Dom转jQuery var dom = document.getElementById("id"); var jq = $(dom); alert(jq.html()); //jQuery转Dom var jq = $("#id"); var dom = $(jq)[0];//是数组,判断的话:$(jq).length>…

2011-03-21 17:27 · JQuery