學習:http://visualjquery.com/1.1.2.html
DOM
Attributes
1.attr(key, value)
$("img").attr("title", "xx");
也是對屬性的添加但可以動態(tài)
eg:??? 在每次給title時 動態(tài)了開始
<img title="pic" /><img title="pic" /><img title="pic" />
通過$("img").attr("title", function(index) { return this.title + (i + 1); });
<img title="pic1" /><img title="pic2" /><img title="pic3" />
2.? html 內(nèi)容取、賦值
取??<div><input/></div>? ->>??$("div").html(); ->>? 結(jié)果:<input/>
賦? $("div").html("<b>new stuff</b>"); ->><div><b>new stuff</b></div>
通過這 ajax 就很簡單了。^_^
Manipulation
1.位置調(diào)換 after, append、before
$("p").after("<b>Hello</b>");??? <p>后 添加 <b>..
$("p").after( $("#foo")[0] );? 把id為foo的標簽移動到<p>后
$("input[@name='butt1']").clone().prependTo("form"); //clone in form
DOM
Attributes
1.attr(key, value)
$("img").attr("title", "xx");
也是對屬性的添加但可以動態(tài)
eg:??? 在每次給title時 動態(tài)了開始
<img title="pic" /><img title="pic" /><img title="pic" />
通過$("img").attr("title", function(index) { return this.title + (i + 1); });
<img title="pic1" /><img title="pic2" /><img title="pic3" />
2.? html 內(nèi)容取、賦值
取??<div><input/></div>? ->>??$("div").html(); ->>? 結(jié)果:<input/>
賦? $("div").html("<b>new stuff</b>"); ->><div><b>new stuff</b></div>
通過這 ajax 就很簡單了。^_^
Manipulation
1.位置調(diào)換 after, append、before
$("p").after("<b>Hello</b>");??? <p>后 添加 <b>..
$("p").after( $("#foo")[0] );? 把id為foo的標簽移動到<p>后
$("input[@name='butt1']").clone().prependTo("form"); //clone in form