JAVA | mysql | php | DELPHI | ORACLE | .NET | FLEX | HTML | C++ | LINUX
您所在的位置: 首页 > 我的资料

jQuery-位置选择器

来源:武汉999
浏览次数:0                             2010-02-25 00:00
我要评论(0)  |  复制链接  |     

:checkbox:checked:enabled
//选择己启用的己选中复选框

input:not(:checkbox)
div p:not(:hidden)

$("<div>Hello</div>")
//新建<div>元素以便添加到页面里,等同$("<div>")

$("<div class=’foo’>I have foo!</div><div>I don’t</div>").filter(".foo").click(function(){
  alert("I’m foo!");
}).end().appendTo("#someParentDiv");

$(’#someDiv’).html(’Therre are ’+$(’a’).size()+’link(s) on this page.’);

$('img[alt]’)[0]
等效于
$('img[alt]’).get(0)

//get()方法也可用于把元素包装集转化为普通JavaScript数组
var allLabeledButtons = $(’label + button’).get();

var n = $(’img’).index($(’img#findMe’)[0]);
//把页面上前面是近邻<label>元素的所有<button>元素包装到jQuery包装器里,然后创建由那些元素所组成的JavaScript数组,赋值组变量allLabeledButtons.

$(’img[alt],img[title]’)
//匹配带有alt或title特性的所有<img>元素

$('img[alt]’).add(’img[title]’)

$('img[alt]’).addClass(’thickBorder’).add(’img[title]’).addClass(’seeThrough’)

$('img[alt]’).add(someElement)

$(’p’).add(’<div>Hi there!</div>’) 

$('img[title]’).not(’[title*=puppy]’)

$('td’).filter(function(){return this.innerHTML.math(/^\d+$/)})

$(’img’).addClass(’seeThrough’).filter(’[tiger*=dog]’).addClass(’thickBorder’)

$('*').slice(2,3);
//获取第3个元素的新包装集,与$(’*’).get(2)不同

$('*').slice(0,4);
//选择页面上所有元素,然后创建包含前4个元素的新包装集

$('*').slice(4);
//匹配页面上所有元素,然后返回包含(除前4个元素以外)所有元素的新包装集

 

 

欢迎进入武汉999论坛  |  发表评论  | 责任编辑: tiger
相关新闻
sosoMap908 zhidaoMap2261 sosoMap490 sosoMap901 zhidaoMap893 infoMap1 sosoMap1363 zhidaoMap3106 zhidaoMap329 zhidaoMap4432 sosoMap1982 totalPage_zhidao=4557 totalPage_soso=2426 totalPage_info=1