Set a gradient to an inline SVG with jQuery SVG plugin
<p>how can i load this svg and set the gradient with the <a href="http://keith-wood.name/svg.html" rel="nofollow">jQuery SVG Plugin</a>?<br /></p>

<pre><code>&lt;div id="test"&gt;
    &lt;svg style="transform: none; backface-visibility: hidden; transform-origin: 50% 50% 0px; cursor: move;" width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 64 64"&gt;
         &lt;g&gt;
         &lt;path d="M32,2.47c-14.027,0-25.44,10.357-25.44,23.088c0,7.572,4.092,14.662,10.95,18.979c0.255,7.662-2.309,14.418-2.419,14.699 l-0.899,2.295l18.509-12.899c13.647-0.34,24.74-10.677,24.74-23.073C57.44,12.827,46.028,2.47,32,2.47z"&gt;
        &lt;/path&gt;
         &lt;/g&gt;
    &lt;/svg&gt;
&lt;/div&gt;
</code></pre>

<p>This doest not work, but why?</p>

<pre><code>var svg = $('#test svg').svg('get');                  
svg.linearGradient( $('#test svg'), 
                    'MyGradient', 
                    [ ['5%', '#F60'], ['95%', '#FF6']] );
</code></pre>

<p>Error:</p>

<pre><code>TypeError: svg is undefined
</code></pre>

<p>i included all js files correctly</p>

<pre><code>jquery.js
jquery-ui.js 
jquery.svg.js
jquery.svgfilter.js
</code></pre>

<p><strong>UPDATE</strong>
Demo: <a href="https://jsfiddle.net/Ltbgcfb8/" rel="nofollow">https://jsfiddle.net/Ltbgcfb8/</a></p>

<p><strong>DOCS</strong>
<a href="http://keith-wood.name/svgRef.html#svgparams" rel="nofollow">http://keith-wood.name/svgRef.html#svgparams</a></p>

<pre><code>$(selector).svg({loadURL: '', onLoad: fn, settings: {}, initPath: ''})
</code></pre>

<p>Attach an SVG canvas to the specified division or inline SVG element.</p>

<p><strong>loadURL</strong> (string, optional) is the URL of the initial document to load.</p>

<p><strong>onLoad</strong> (function, optional) is a callback functional invoked following loading. It receives a reference to the SVG Wrapper object as a parameter. this refers to the containing division.</p>

<p><strong>settings</strong> (object, optional) is the new settings to use for this SVG instance.</p>

<p><strong>initPath</strong> (string, optional) is any additional path to the blank.svg file.</p>

<pre><code>Since 1.1.0 - previously you used $(selector).svg(url, onLoad, settings);.
Since 1.2.0 - initPath setting and onLoad receives parameter of SVG Wrapper object.
Since 1.4.3 - allow target object to be inline SVG.
</code></pre>