Javascript extract value inside parentheses between commas (Increase element's transform function arguments)How do I extract text that lies between parentheses (round brackets)?Set a default parameter value for a JavaScript functionWhat is the difference between a function expression vs declaration in JavaScript?JavaScript variable number of arguments to functionPassing arguments forward to another javascript functionDefault argument values in JavaScript functionsExtract -webkit-transform matrix3d valuesRegex 2 searches in 1 regexRegular Expression to get a string between parentheses in JavascriptSearching for code inside function using Javascript
Non-trope happy ending?
How to convince somebody that he is fit for something else, but not this job?
Why do ¬, ∀ and ∃ have the same precedence?
Why is it that I can sometimes guess the next note?
How much of a Devil Fruit must be consumed to gain the power?
How does electrical safety system work on ISS?
Why does AES have exactly 10 rounds for a 128-bit key, 12 for 192 bits and 14 for a 256-bit key size?
Change the color of a single dot in `ddot` symbol
The Digit Triangles
Quoting Keynes in a lecture
Does grappling negate Mirror Image?
Creating two special characters
Stack Interview Code methods made from class Node and Smart Pointers
I found an audio circuit and I built it just fine, but I find it a bit too quiet. How do I amplify the output so that it is a bit louder?
How to draw a matrix with arrows in limited space
A variation to the phrase "hanging over my shoulders"
A Trivial Diagnosis
awk assign to multiple variables at once
What is Cash Advance APR?
Delete multiple columns using awk or sed
Did the UK lift the requirement for registering SIM cards?
What is going on with gets(stdin) on the site coderbyte?
Mimic lecturing on blackboard, facing audience
How would you translate "more" for use as an interface button?
Javascript extract value inside parentheses between commas (Increase element's transform function arguments)
How do I extract text that lies between parentheses (round brackets)?Set a default parameter value for a JavaScript functionWhat is the difference between a function expression vs declaration in JavaScript?JavaScript variable number of arguments to functionPassing arguments forward to another javascript functionDefault argument values in JavaScript functionsExtract -webkit-transform matrix3d valuesRegex 2 searches in 1 regexRegular Expression to get a string between parentheses in JavascriptSearching for code inside function using Javascript
The context here is simple, I want to capture the transform css value from a graphic element and increase it by 10.
In my case the only transform I have is translate, but ideally it would work if there are other ones as well as I only want to change the translate value.
I tagged it as regex but not sure if it's needed.
const myElement = document.getElementById('myElement');
const translateString = myElement.getAttribute('transform');
const newTranslateString = increaseArgumentsBy10(translateString);
myElement.setAttribute('transform', newTranslateString);
function increaseArgumentsBy10(translateString)
console.log('To be implemented');
return translateString;
<svg>
<text id="myElement" transform="translate(50,50)">My Element
</text>
</svg>javascript regex
add a comment |
The context here is simple, I want to capture the transform css value from a graphic element and increase it by 10.
In my case the only transform I have is translate, but ideally it would work if there are other ones as well as I only want to change the translate value.
I tagged it as regex but not sure if it's needed.
const myElement = document.getElementById('myElement');
const translateString = myElement.getAttribute('transform');
const newTranslateString = increaseArgumentsBy10(translateString);
myElement.setAttribute('transform', newTranslateString);
function increaseArgumentsBy10(translateString)
console.log('To be implemented');
return translateString;
<svg>
<text id="myElement" transform="translate(50,50)">My Element
</text>
</svg>javascript regex
add a comment |
The context here is simple, I want to capture the transform css value from a graphic element and increase it by 10.
In my case the only transform I have is translate, but ideally it would work if there are other ones as well as I only want to change the translate value.
I tagged it as regex but not sure if it's needed.
const myElement = document.getElementById('myElement');
const translateString = myElement.getAttribute('transform');
const newTranslateString = increaseArgumentsBy10(translateString);
myElement.setAttribute('transform', newTranslateString);
function increaseArgumentsBy10(translateString)
console.log('To be implemented');
return translateString;
<svg>
<text id="myElement" transform="translate(50,50)">My Element
</text>
</svg>javascript regex
The context here is simple, I want to capture the transform css value from a graphic element and increase it by 10.
In my case the only transform I have is translate, but ideally it would work if there are other ones as well as I only want to change the translate value.
I tagged it as regex but not sure if it's needed.
const myElement = document.getElementById('myElement');
const translateString = myElement.getAttribute('transform');
const newTranslateString = increaseArgumentsBy10(translateString);
myElement.setAttribute('transform', newTranslateString);
function increaseArgumentsBy10(translateString)
console.log('To be implemented');
return translateString;
<svg>
<text id="myElement" transform="translate(50,50)">My Element
</text>
</svg>const myElement = document.getElementById('myElement');
const translateString = myElement.getAttribute('transform');
const newTranslateString = increaseArgumentsBy10(translateString);
myElement.setAttribute('transform', newTranslateString);
function increaseArgumentsBy10(translateString)
console.log('To be implemented');
return translateString;
<svg>
<text id="myElement" transform="translate(50,50)">My Element
</text>
</svg>const myElement = document.getElementById('myElement');
const translateString = myElement.getAttribute('transform');
const newTranslateString = increaseArgumentsBy10(translateString);
myElement.setAttribute('transform', newTranslateString);
function increaseArgumentsBy10(translateString)
console.log('To be implemented');
return translateString;
<svg>
<text id="myElement" transform="translate(50,50)">My Element
</text>
</svg>javascript regex
javascript regex
asked 12 hours ago
MojimiMojimi
4051033
4051033
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
you can create a function translate and use eval
const myElement = document.getElementById('myElement');
const translateString = myElement.getAttribute('transform');
const newTranslateString = increaseArgumentsBy10(translateString);
myElement.setAttribute('transform', newTranslateString);
function increaseArgumentsBy10(translateString)
function translate(x, y)
return('translate(' + (x + 10) + ', ' + (y + 10) + ')');
return eval(translateString);
<svg>
<text id="myElement" transform="translate(50,50)">My Element
</text>
</svg>
That's very, very clever but seems illegal
– Mojimi
11 hours ago
@Mojimi you have to usetry cacth(e)and it would be totaly legal ;-)
– tomboul
9 hours ago
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55280170%2fjavascript-extract-value-inside-parentheses-between-commas-increase-elements-t%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
you can create a function translate and use eval
const myElement = document.getElementById('myElement');
const translateString = myElement.getAttribute('transform');
const newTranslateString = increaseArgumentsBy10(translateString);
myElement.setAttribute('transform', newTranslateString);
function increaseArgumentsBy10(translateString)
function translate(x, y)
return('translate(' + (x + 10) + ', ' + (y + 10) + ')');
return eval(translateString);
<svg>
<text id="myElement" transform="translate(50,50)">My Element
</text>
</svg>
That's very, very clever but seems illegal
– Mojimi
11 hours ago
@Mojimi you have to usetry cacth(e)and it would be totaly legal ;-)
– tomboul
9 hours ago
add a comment |
you can create a function translate and use eval
const myElement = document.getElementById('myElement');
const translateString = myElement.getAttribute('transform');
const newTranslateString = increaseArgumentsBy10(translateString);
myElement.setAttribute('transform', newTranslateString);
function increaseArgumentsBy10(translateString)
function translate(x, y)
return('translate(' + (x + 10) + ', ' + (y + 10) + ')');
return eval(translateString);
<svg>
<text id="myElement" transform="translate(50,50)">My Element
</text>
</svg>
That's very, very clever but seems illegal
– Mojimi
11 hours ago
@Mojimi you have to usetry cacth(e)and it would be totaly legal ;-)
– tomboul
9 hours ago
add a comment |
you can create a function translate and use eval
const myElement = document.getElementById('myElement');
const translateString = myElement.getAttribute('transform');
const newTranslateString = increaseArgumentsBy10(translateString);
myElement.setAttribute('transform', newTranslateString);
function increaseArgumentsBy10(translateString)
function translate(x, y)
return('translate(' + (x + 10) + ', ' + (y + 10) + ')');
return eval(translateString);
<svg>
<text id="myElement" transform="translate(50,50)">My Element
</text>
</svg>you can create a function translate and use eval
const myElement = document.getElementById('myElement');
const translateString = myElement.getAttribute('transform');
const newTranslateString = increaseArgumentsBy10(translateString);
myElement.setAttribute('transform', newTranslateString);
function increaseArgumentsBy10(translateString)
function translate(x, y)
return('translate(' + (x + 10) + ', ' + (y + 10) + ')');
return eval(translateString);
<svg>
<text id="myElement" transform="translate(50,50)">My Element
</text>
</svg>const myElement = document.getElementById('myElement');
const translateString = myElement.getAttribute('transform');
const newTranslateString = increaseArgumentsBy10(translateString);
myElement.setAttribute('transform', newTranslateString);
function increaseArgumentsBy10(translateString)
function translate(x, y)
return('translate(' + (x + 10) + ', ' + (y + 10) + ')');
return eval(translateString);
<svg>
<text id="myElement" transform="translate(50,50)">My Element
</text>
</svg>const myElement = document.getElementById('myElement');
const translateString = myElement.getAttribute('transform');
const newTranslateString = increaseArgumentsBy10(translateString);
myElement.setAttribute('transform', newTranslateString);
function increaseArgumentsBy10(translateString)
function translate(x, y)
return('translate(' + (x + 10) + ', ' + (y + 10) + ')');
return eval(translateString);
<svg>
<text id="myElement" transform="translate(50,50)">My Element
</text>
</svg>answered 12 hours ago
tomboultomboul
6615
6615
That's very, very clever but seems illegal
– Mojimi
11 hours ago
@Mojimi you have to usetry cacth(e)and it would be totaly legal ;-)
– tomboul
9 hours ago
add a comment |
That's very, very clever but seems illegal
– Mojimi
11 hours ago
@Mojimi you have to usetry cacth(e)and it would be totaly legal ;-)
– tomboul
9 hours ago
That's very, very clever but seems illegal
– Mojimi
11 hours ago
That's very, very clever but seems illegal
– Mojimi
11 hours ago
@Mojimi you have to use
try cacth(e) and it would be totaly legal ;-)– tomboul
9 hours ago
@Mojimi you have to use
try cacth(e) and it would be totaly legal ;-)– tomboul
9 hours ago
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55280170%2fjavascript-extract-value-inside-parentheses-between-commas-increase-elements-t%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown