Unfortunately webkit doesn't support neither .sourceIndex
nor .compareDocumentPosition.
Here's another take, this should work in all browsers:
$.fn.inOrder = function(sel){
return this.filter(function(){
return $(this).is(sel);
});
}
$('body *').inOrder('div,span,p')
First you need
Thanks for the plugin, Ricardo. It works great in FF3 and IE7, but it
doesn't work in Chrome.
For my current needs, using the selector ":input" provides the form input
controls in the dom order.
var first_form_control = $('form#myform').find(':input').eq(0);
Thanks for the help and suggestions. :
looks good!
$('#myform').find('input,select,textarea').sort();
On Mon, Dec 1, 2008 at 9:09 PM, ricardobeat <[EMAIL PROTECTED]> wrote:
>
> Here's a kind of 'DOM order sort plugin' I just made adapting code
> from the 'getElementsByTagNames' function by Peter-Paul Koch (http://
> www.quirksmode.o
Here's a kind of 'DOM order sort plugin' I just made adapting code
from the 'getElementsByTagNames' function by Peter-Paul Koch (http://
www.quirksmode.org/dom/getElementsByTagNames.html).
I haven't tested it anywhere besides FF3. Just use it as:
$('div,span').sort()
(function($){
$.fn.sort = f
FWIW, same problem using
$('form#myform').find('*').filter('input,select,textarea');
It seems that jQuery creates a new collection but iterates through for each
selector in filter(), gathering matches from the source, rather than running
through the source and comparing each element with each sele
5 matches
Mail list logo