I discovered by accident these days ago that in jQuery it is possible to pass a callback function to the html
function.
See:
$(function ()
{
$('body').html(function ()
{
return [1, 2, 3, 4, 5];
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
And not only that, but also for functions css
, prepend
, append
and etc ...
At last, I'd like to know what benefits I could get through this jQuery functionality.