The question is as simple as - is it possible to create a user-defined method for standard js objects like the val method for input ? That is, to do smth like:
function my_new_method()
{
...
}
...
alert($('td input').my_new_method())
The question is as simple as - is it possible to create a user-defined method for standard js objects like the val method for input ? That is, to do smth like:
function my_new_method()
{
...
}
...
alert($('td input').my_new_method())
Since that is looks like jQuery (not vanilla/standard JavaScript), you can simply use $.fn.my_new_method = // your function
You can read up on how to create a jQuery plugin here: https://learn.jquery.com/plugins/basic-plugin-creation/