Hi Gregor -
I used your code sample from this thread to set a global variable to the pixel width of a textfield, which worked great:
javascript:void($axure.setGlobalVariable(“w1”,$( “[data-label=lenTest] .text span”).width()));
In general, though, I avoid using global variables (where possible) and instead use the text of a shape, so I was hoping to put the pixel length result into the text of a shape instead.
I saw on another of your posts an example where you set the text on a shape through javascript, so I tried to hobble together the two examples. (Disclaimer, I know next to nothing about javascript, especially in regards to adding it to Axure.)
I came up with code below with no success. The shape lenTest has the string I want the pixel length of, and the shape textLen will receive that length in its text:
javascript:void($axure(’@textLen’).text($( “[data-label=lenTest] .text span”).width()));
Note that if I change it to simply set textLen’s text to a string, that works fine:
javascript:void($axure(’@textLen’).text(‘hello’));
Can you see what I’m doing wrong? Also, do you have advice on a good place for me to start (in addition to becoming more familiar with javascript) in learning incorporate js into Axure?
Thanks!