I was able to use pure javascript to get the element and set the attribute by using
var svg = document.getElementsByTagName("svg")[0];
and
svg.setAttribute("viewBox","...");
More Related Contents:
- .prop() vs .attr()
- jQuery SVG, why can’t I addClass?
- How to use z-index in svg elements?
- Set attribute without value
- jQuery attr vs prop?
- How to check if an embedded SVG document is loaded in an html page?
- jQuery Selector + SVG Incompatible?
- SVG – click is not a function [duplicate]
- Is it possible to append a div inside an SVG element? [duplicate]
- How do I save/export an SVG file after creating an SVG with D3.js (IE, safari and chrome)?
- Add names of the states to a map in d3.js
- Setting new value for an attribute using jQuery
- How to get the width of an svg:g element
- Include SVG files with HTML, and still be able to apply styles to them?
- jQuery SVG vs. Raphael [closed]
- Create a table in SVG
- JS & jQuery can’t detect html elements, and say’s they are undefined
- jQuery : simulating a click on a doesn’t work in Firefox? [duplicate]
- “Mixed content blocked” when running an HTTP AJAX operation in an HTTPS page
- Chrome Extension how to send data from content script to popup.html
- How do I achieve equal height divs (positioned side by side) with HTML / CSS ?
- jQuery issue in Internet Explorer 8
- jQuery event delegation
- React JS onClick event handler
- Javascript / Jquery – Get number from string
- Click link inside Leaflet Popup and do Javascript
- Iframe inherit from parent
- Not able to launch a pdf file in inappbrowser in android
- How to capture browser close event?
- customize highcharts tooltip to show datetime