<p class="foo">クラスを持つPタグ</p>
<p>クラスを持たないPタグ</p>
Ext.select( ‘p[class]‘, true ).each(function(el){
el.highlight();
});
<p class="x-foo">x-fooがクラスで指定されているPタグ</p>
<p class="x-bar">x-barがクラスで指定されているPタグ</p>
Ext.select( ‘p[class="x-foo"]‘, true ).each(function(el){
el.highlight();
});
<p class="x-foo">x-fooがクラスで指定されているPタグ</p>
<p class="x-bar">x-barがクラスで指定されているPタグ</p>
<p class="y-foo">y-fooがクラスで指定されているPタグ</p>
Ext.select( ‘p[class^="x-"]‘, true ).each(function(el){
el.highlight();
});
<p class="x-foo1">x-foo1がクラスで指定されているPタグ</p>
<p class="x-foo2">x-foo2がクラスで指定されているPタグ</p>
<p class="x-woo1">x-woo1がクラスで指定されているPタグ</p>
<p class="x-bar">x-barがクラスで指定されているPタグ</p>
Ext.select( ‘p[class$="oo1"]‘, true ).each(function(el){
el.highlight();
})
<p class="x-foo1">x-foo1がクラスで指定されているPタグ</p>
<p class="x-foo2">x-foo2がクラスで指定されているPタグ</p>
<p class="y-foo1">y-foo1がクラスで指定されているPタグ</p>
<p class="y-foo2">y-foo2がクラスで指定されているPタグ</p>
Ext.select( ‘p[class*="foo"]‘, true ).each(function(el){
el.highlight();
});
タグの属性値が2で割り切れるエレメントを抽出します。次の例では、imgタグのwidthが2で割り切れるものを選択しています。
<img width="100" src="http://code.xenophy.com/wp-content/uploads/2009/06/extjslearnlogo.png" />
<img width="101" src="http://code.xenophy.com/wp-content/uploads/2009/06/extjslearnlogo.png" />
Ext.select( ‘img[width%=2]‘, true ).each(function(el){
el.frame();
});
属性値が異なるエレメントを抽出します。次の例では、imgタグのwidthが100でないもの、を選択しています。
<img width="100" src="http://code.xenophy.com/wp-content/uploads/2009/06/extjslearnlogo.png" />
<img width="101" src="http://code.xenophy.com/wp-content/uploads/2009/06/extjslearnlogo.png" />
Ext.select( ‘img[width!="100"]‘, true ).each(function(el){
el.frame();
});