is it possible to extend values and variables as you can with elements?
I'm looking into writing some jQuery extensions.
Example:
- $.fn.IsTest = function () {
- let result = this.val() === "test";
- return result;
- }
Usage:
So far I have written extensions for the input element and as you can see I use val() to get the value. but is it possible to write an extension for the value itself or a variable?
Ex:
- $.fn.IsTest = function () {
- let result = this === "test";
- return result;
- }
Usage like this:
- $("select").val().IsTest();
- let v = "test";
- v.IsTest();
Thanks!