This is bit tough question. I”m using third party library that will insert result into DOM.
Example:
$('#puthere').thirdpartyplugin();
this will call thirdpartyplugin and manipulate result of HTML element #puthere.
My question is, how to output result to JavaScript variable rather than DOM element?
var plainOutput = $.thirdpartyplugin(); alert(plainOutput);
I do not want to manipulate HTML element that is visible to users. I just want to call alert(plainOutput) the result.
Create a temporary element:
This might or might not work, depending on what the plugin is doing.
If the plugin plays by the rules and supports method chaining, you can also do: