Created
August 8, 2012 09:27
-
-
Save netsi1964/3293753 to your computer and use it in GitHub Desktop.
jQuery psedu-selectors
This file contains hidden or 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
/* | |
Sten Hougaard, 2012-08-08 | |
29/05/2014 10.55: Updated | |
Extends jQuery with psedu-selector: | |
:between(iFrom, iTo) | |
Will return elements which has position between iFrom and iTo. | |
*/ | |
(function($) { | |
$.extend($.expr[':'], { | |
between: function(element, index, matches, set) { | |
var fromTo =matches[3].split(','); | |
return (index>=fromTo[0] && index<=fromTo[1]); | |
} | |
}); | |
})(jQuery); |
This file contains hidden or 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
/* | |
Sten Hougaard, 2012-12-05 | |
Extends jQuery with psedu-selector: | |
:emptyValue | |
Will return true if a trimmed value of an element is empty. | |
*/ | |
(function($) { | |
$.extend($.expr[':'],{ | |
emptyValue: function(element, index, matches, set){ | |
return $.trim($(element).val()) === ""; | |
} | |
}); | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment