posts - 165, comments - 198, trackbacks - 0, articles - 1
            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

          jquery學習筆記_2

          Posted on 2007-11-09 10:34 G_G 閱讀(323) 評論(0)  編輯  收藏 所屬分類: javascript Framework
          學習: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

          主站蜘蛛池模板: 瑞丽市| 石楼县| 濮阳市| 三台县| 长沙县| 青铜峡市| 改则县| 玉田县| 赤城县| 德清县| 元氏县| 方正县| 屯门区| 兰州市| 舞钢市| 天等县| 盱眙县| 阳泉市| 罗甸县| 老河口市| 宿松县| 景洪市| 稻城县| 吉林市| 聂拉木县| 利辛县| 宁乡县| 麻阳| 清苑县| 赤壁市| 延川县| 盘山县| 白山市| 永春县| 进贤县| 庐江县| 铁力市| 张家港市| 满洲里市| 宁武县| 新营市|