D
D
Dima2018-08-28 16:58:39
JavaScript
Dima, 2018-08-28 16:58:39

How to properly embed a construct in a string?

Forgive me in advance. I don’t know what the question specifically refers to, so I set the tags. There is a script that when you click on the button displays a line in which there is a variable. let's say the line looks like this

var a=1;
$('<h1>'+a+'</h1>');

everything comes out great.
but I need to display this construction so that I can edit the text from the admin panel. I need to output like this:
<%=Language.Get("Footer_products_title") %>
$('<h1>'+<%=Language.Get("Footer_products_title") %>+'</h1>');

No matter what I do, I run into three problems:
  1. My unknowing brain
  2. This entry is output as a string and is not interpreted into what I want
  3. The line is not displayed, because the script itself breaks

Again, sorry if anything, I'm trying to figure it out)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Proskurin, 2018-08-28
Dolgoter @SpiderPigAndCat

Does it come from the server? If yes, then like this
should work.
If this is from a template engine in JS, then like this

$('<h1>' + Language.Get("Footer_products_title") + '</h1>');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question