Last active
October 27, 2022 21:43
-
-
Save tevashov/5172463 to your computer and use it in GitHub Desktop.
Write your own selectors #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
| //extend the jQuery functionality | |
| $.extend($.expr[':'], { | |
| //name of your special selector | |
| moreThanAThousand : function (a){ | |
| //Matching element | |
| return parseInt($(a).html()) > 1000; | |
| } | |
| }); | |
| $(document).ready(function() { | |
| $('td:moreThanAThousand').css('background-color', '#ff0000'); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment