Created
July 13, 2011 18:34
-
-
Save AndreMikulec/1080961 to your computer and use it in GitHub Desktop.
YUI3swapEX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html><head><script src="http://yui.yahooapis.com/3.3.0/build/yui/yui-min.js"></script></head><body> | |
<div class="children" style=""> | |
<div class="myitem"> | |
<li> | |
<div> | |
<span>_98</span> | |
</div> | |
</li> | |
</div> | |
<div class="myitem"> | |
<li> | |
<div> | |
<span>_96</span> | |
</div> | |
</li> | |
</div> | |
</div> | |
<script>YUI().use('node', function(Y) { | |
var itemNodeList = Y.all('.children .myitem'); | |
alert(itemNodeList.item(0).one('span').get('text')); // _98 1st alert CORRECT | |
alert(itemNodeList.item(1).one('span').get('text')); // _96 2nd alert CORRECT | |
itemNodeList.item(0).swap(itemNodeList.item(1)); // SEE REORDERED _96 _98 ON PAGE - CORRECT | |
alert(itemNodeList.item(0).one('span').get('text')); // _98 3rd alert BUT I WANT TO SEE alert _96 | |
alert(itemNodeList.item(1).one('span').get('text')); // _96 4th alert BUT I WANT TO SEE alert _98 | |
});</script></body></html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment