I have a question on how anonymous functions work in Javascript. I saw this beautiful piece of code to toggle "disabled" from an html element [from this post link to stack overflow ]:
$('#el').prop('disabled', function(i, v) { return !v; });
The inputs to the anonymous function i and v are the index and the value.
Why is that? Is it because of .prop() or is this somehow a property of the anonymous functions? Are there other inputs available? Thanks
SOLUTION: The answer to my question is in the docs for .prop() api.jquery.com/prop/: