toJQuery()

The toJQuery linq operator returns a jQuery object that is made up of the elements of the collection. Note, that the toJQuery operator will throw an exception if it is invoked when jQuery is not available.
var links = $('a');

// col1 = a jQuery object containing links with an empty 'href' property
// note: it would be much more sensible to use $('a[href=""]') for this
// specific example :)
var col1 = $linq(links)
    .where("x => x.href == ''")
    .toJQuery();

// col2 = a jQuery object containing distinct links (case-insensitive)
var col2 = $linq(links)
    .distinctBy("x => x.href", "(x, y) => x.toLowerCase() == y.toLowerCase()")
    .toJQuery();

Last edited Oct 12, 2012 at 4:14 AM by battousai999, version 1