ok if they start with a same prefix you can do something like this
$obj = $('[id^=div]');
here is the fiddle: http://jsfiddle.net/wytXQ/
문제
I want to sort elements by position in the page. Meaning if I have an object:
$obj = $('#div1, #div2, #div3');
But my markup is like:
<div id="div3"></div>
<div id="div1"></div>
<div id="div2"></div>
How would I sort $obj to be $('#div3, #div1, #div2');
Thanks!
해결책
ok if they start with a same prefix you can do something like this
$obj = $('[id^=div]');
here is the fiddle: http://jsfiddle.net/wytXQ/