How pass string to $w(..)?

Hi,

I have a button name stored locally,

I want to pass the name of string in:
$w(#name)

my code: $w(# + str)

but It doesn’t work, help me please, thank you.

You should be doing something like this:

$w(`#${str}`);

See the article on template literals for more information.

You should also be able to do something like this:

$w('#' + str);

Don’t forget to put the # in quotes.