首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

jquery in action2的学习札记(二)

2012-11-04 
jquery in action2的学习笔记(二)二:Bringing pages to lifewith jQueryimg idmyImage srcimage.gif

jquery in action2的学习笔记(二)


二:Bringing pages to life
with jQuery

<img id="myImage" src="image.gif" alt="jquery in action2的学习札记(二)" data-custom ="some value"/>

1:As an example of using the each() method, we could use the following code to set the
id property of every element in the DOM to a name composed of the element’s tag
name and position within the DOM:



Recall that the attr() method will return undefined if the attribute in question
doesn’t exist, so this statement will throw an error if the <p> element doesn’t possess
any class names.

We could solve this by first checking for the attribute



8:expand the width of all elements
in the wrapped set by 20 pixels as follows:

$('input,select').val(['one','two','three']);

热点排行