I have SVG images and I want to export their files as img then change them back to SVG .. the reason of the change is that I want to change all the rectangles colours inside the SVG images.
I used a way described in How to change color of SVG image using CSS (jQuery SVG image replacement) but nothing change. I also when I see the Inspect from the browser the image is still img tag not SVG tag..
the problem is that the SVG embed inside Object .. the Object inside table cell .. the table rows created row by row using javascript I could not access the SVG rectangles to change them.. thats my problem :( it has been week trying .. when it is inline SVG I can change it but many SVGs embedding inside object I could not change them
<body>
<fieldset id="output" class="form">
<legend class="main">Output</legend>
<br>
<table cellpadding="0" cellspacing="0" class="display" id="Table" style="table-layout: fixed" width="auto" >
<tbody>
</tbody>
</table>
</fieldset>
</body>
and here the script :
for( var j=0,g=0; g < 3; j++,g++ ) {
//--------- start drawing the table
var table = document.getElementById("Table");
var row = document.createElement('tr');
row.id="singlerow";
// first col----
var link="http://imgh.us/A_acidus_CBS_106_47_Aspfo1_0027407.svg";
var obj = document.createElement('object');
obj.class="alphasvg";
obj.setAttribute('data',link );
obj.setAttribute('height','30px');
obj.setAttribute('width','300px');
var cell3 = row.insertCell(0);
cell3.id="genemodelcell";
cell3.appendChild(obj);
//insert row
table.appendChild(row);
}//end for loop
code sample :SVG inside object inside cell
`. (If it's external files it can be loaded in the head with defer or async). You can use jQuery to [check if the document is ready](http://learn.jquery.com/using-jquery-core/document-ready/)
– Cohars Sep 11 '14 at 20:50